Search in sources :

Example 26 with TextWebSocketFrame

use of io.netty.handler.codec.http.websocketx.TextWebSocketFrame in project async-http-client by AsyncHttpClient.

the class NettyWebSocket method handleFrame.

public void handleFrame(WebSocketFrame frame) {
    if (frame instanceof TextWebSocketFrame) {
        onTextFrame((TextWebSocketFrame) frame);
    } else if (frame instanceof BinaryWebSocketFrame) {
        onBinaryFrame((BinaryWebSocketFrame) frame);
    } else if (frame instanceof CloseWebSocketFrame) {
        Channels.setDiscard(channel);
        CloseWebSocketFrame closeFrame = (CloseWebSocketFrame) frame;
        onClose(closeFrame.statusCode(), closeFrame.reasonText());
        Channels.silentlyCloseChannel(channel);
    } else if (frame instanceof PingWebSocketFrame) {
        onPing((PingWebSocketFrame) frame);
    } else if (frame instanceof PongWebSocketFrame) {
        onPong((PongWebSocketFrame) frame);
    }
}
Also used : CloseWebSocketFrame(io.netty.handler.codec.http.websocketx.CloseWebSocketFrame) PongWebSocketFrame(io.netty.handler.codec.http.websocketx.PongWebSocketFrame) TextWebSocketFrame(io.netty.handler.codec.http.websocketx.TextWebSocketFrame) BinaryWebSocketFrame(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame) PingWebSocketFrame(io.netty.handler.codec.http.websocketx.PingWebSocketFrame)

Aggregations

TextWebSocketFrame (io.netty.handler.codec.http.websocketx.TextWebSocketFrame)26 URI (java.net.URI)16 FrameChecker (io.undertow.websockets.utils.FrameChecker)15 WebSocketTestClient (io.undertow.websockets.utils.WebSocketTestClient)15 Test (org.junit.Test)15 FutureResult (org.xnio.FutureResult)15 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 BinaryWebSocketFrame (io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame)5 CloseWebSocketFrame (io.netty.handler.codec.http.websocketx.CloseWebSocketFrame)5 WebSocketFrame (io.netty.handler.codec.http.websocketx.WebSocketFrame)5 ServerWebSocketContainer (io.undertow.websockets.jsr.ServerWebSocketContainer)5 UndertowSession (io.undertow.websockets.jsr.UndertowSession)5 AnnotatedClientEndpoint (io.undertow.websockets.jsr.test.annotated.AnnotatedClientEndpoint)5 ByteBuf (io.netty.buffer.ByteBuf)4 IOException (java.io.IOException)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)4 Endpoint (javax.websocket.Endpoint)4 EndpointConfig (javax.websocket.EndpointConfig)4 MessageHandler (javax.websocket.MessageHandler)4 Session (javax.websocket.Session)4