Java Code Examples for io.vertx.core.http.ServerWebSocket#writeTextMessage()

The following examples show how to use io.vertx.core.http.ServerWebSocket#writeTextMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSocketTestController.java    From festival with Apache License 2.0 5 votes vote down vote up
@OnActive
public void active(ServerWebSocket serverWebSocket, WebSocketFrame webSocketFrame) {
    log.info("active......");
    JsonObject jsonObject = new JsonObject();
    jsonObject.put("type", 1);
    jsonObject.put("data", "hello");
    serverWebSocket.writeTextMessage(jsonObject.encodePrettily());
}
 
Example 2
Source File: WebSocketTestController.java    From festival with Apache License 2.0 4 votes vote down vote up
@OnActive
public void active(ServerWebSocket serverWebSocket, WebSocketFrame webSocketFrame) {
    log.info("active......");
    serverWebSocket.writeTextMessage("hi");
}
 
Example 3
Source File: WebSocketTestController.java    From festival with Apache License 2.0 4 votes vote down vote up
@GetMapping("/send")
public void sendInfo(@Param("id") String id, @Param("info") String info, HttpServerResponse response) {
    ServerWebSocket serverWebSocket = serverWebSocketMap.get(id);
    serverWebSocket.writeTextMessage(info);
    response.end();
}
 
Example 4
Source File: WebSocketTestController.java    From festival with Apache License 2.0 4 votes vote down vote up
@GetMapping("/send")
public void sendInfo(@Param("id") String id, @Param("info") String info, HttpServerResponse response) {
    ServerWebSocket serverWebSocket = serverWebSocketMap.get(id);
    serverWebSocket.writeTextMessage(info);
    response.end();
}