Search in sources :

Example 1 with WebSocketFrameType

use of io.vertx.core.http.WebSocketFrameType in project vert.x by eclipse.

the class Http1xConnectionBase method decodeFrame.

private WebSocketFrameInternal decodeFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame msg) {
    ByteBuf payload = safeBuffer(msg.content());
    boolean isFinal = msg.isFinalFragment();
    WebSocketFrameType frameType;
    if (msg instanceof BinaryWebSocketFrame) {
        frameType = WebSocketFrameType.BINARY;
    } else if (msg instanceof CloseWebSocketFrame) {
        frameType = WebSocketFrameType.CLOSE;
    } else if (msg instanceof PingWebSocketFrame) {
        frameType = WebSocketFrameType.PING;
    } else if (msg instanceof PongWebSocketFrame) {
        frameType = WebSocketFrameType.PONG;
    } else if (msg instanceof TextWebSocketFrame) {
        frameType = WebSocketFrameType.TEXT;
    } else if (msg instanceof ContinuationWebSocketFrame) {
        frameType = WebSocketFrameType.CONTINUATION;
    } else {
        throw new IllegalStateException("Unsupported WebSocket msg " + msg);
    }
    return new WebSocketFrameImpl(frameType, payload, isFinal);
}
Also used : CloseWebSocketFrame(io.netty.handler.codec.http.websocketx.CloseWebSocketFrame) PongWebSocketFrame(io.netty.handler.codec.http.websocketx.PongWebSocketFrame) WebSocketFrameImpl(io.vertx.core.http.impl.ws.WebSocketFrameImpl) ContinuationWebSocketFrame(io.netty.handler.codec.http.websocketx.ContinuationWebSocketFrame) TextWebSocketFrame(io.netty.handler.codec.http.websocketx.TextWebSocketFrame) BinaryWebSocketFrame(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame) WebSocketFrameType(io.vertx.core.http.WebSocketFrameType) ByteBuf(io.netty.buffer.ByteBuf) PingWebSocketFrame(io.netty.handler.codec.http.websocketx.PingWebSocketFrame)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 BinaryWebSocketFrame (io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame)1 CloseWebSocketFrame (io.netty.handler.codec.http.websocketx.CloseWebSocketFrame)1 ContinuationWebSocketFrame (io.netty.handler.codec.http.websocketx.ContinuationWebSocketFrame)1 PingWebSocketFrame (io.netty.handler.codec.http.websocketx.PingWebSocketFrame)1 PongWebSocketFrame (io.netty.handler.codec.http.websocketx.PongWebSocketFrame)1 TextWebSocketFrame (io.netty.handler.codec.http.websocketx.TextWebSocketFrame)1 WebSocketFrameType (io.vertx.core.http.WebSocketFrameType)1 WebSocketFrameImpl (io.vertx.core.http.impl.ws.WebSocketFrameImpl)1