本文整理了Java中org.jooby.Router.ws
方法的一些代码示例,展示了Router.ws
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.ws
方法的具体详情如下:
包路径:org.jooby.Router
类名称:Router
方法名:ws
[英]Append a new WebSocket handler under the given path.
ws(MyHandler.class);
[中]在给定路径下追加一个新的WebSocket处理程序
ws(MyHandler.class);
代码示例来源:origin: jooby-project/jooby
/**
* Append a new WebSocket handler under the given path.
*
* <pre>
* ws(MyHandler.class);
* </pre>
*
* @param handler A message callback.
* @param <T> Message type.
* @return A new WebSocket definition.
*/
@Nonnull
default <T> WebSocket.Definition ws(final Class<? extends WebSocket.OnMessage<T>> handler) {
return ws("", handler);
}
代码示例来源:origin: jooby-project/jooby
/**
* Append a new WebSocket handler under the given path.
*
* <pre>
* ws("/ws", (socket) {@literal ->} {
* // connected
* socket.onMessage(message {@literal ->} {
* System.out.println(message);
* });
* socket.send("Connected"):
* });
* </pre>
*
* @param path A path pattern.
* @param handler A connect callback.
* @return A new WebSocket definition.
*/
@Nonnull
default WebSocket.Definition ws(final String path, final WebSocket.OnOpen1 handler) {
return ws(path, (WebSocket.OnOpen) handler);
}
代码示例来源:origin: jooby-project/jooby
router.ws("/livereload", ws -> {
代码示例来源:origin: jooby-project/jooby
"</html>").type(MediaType.html));
routes.ws(path, new WebShellHandler()).consumes(MediaType.json).produces(MediaType.json);
代码示例来源:origin: org.jooby/jooby
/**
* Append a new WebSocket handler under the given path.
*
* <pre>
* ws(MyHandler.class);
* </pre>
*
* @param handler A message callback.
* @param <T> Message type.
* @return A new WebSocket definition.
*/
@Nonnull
default <T> WebSocket.Definition ws(final Class<? extends WebSocket.OnMessage<T>> handler) {
return ws("", handler);
}
代码示例来源:origin: org.jooby/jooby
/**
* Append a new WebSocket handler under the given path.
*
* <pre>
* ws("/ws", (socket) {@literal ->} {
* // connected
* socket.onMessage(message {@literal ->} {
* System.out.println(message);
* });
* socket.send("Connected"):
* });
* </pre>
*
* @param path A path pattern.
* @param handler A connect callback.
* @return A new WebSocket definition.
*/
@Nonnull
default WebSocket.Definition ws(final String path, final WebSocket.OnOpen1 handler) {
return ws(path, (WebSocket.OnOpen) handler);
}
内容来源于网络,如有侵权,请联系作者删除!