@Override public boolean acceptInboundMessage(Object msg) throws Exception { return ((msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0) || (msg instanceof ContinuationWebSocketFrame && compressing); }
@Override public boolean acceptInboundMessage(Object msg) throws Exception { return (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame || msg instanceof ContinuationWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0; }
@Override public boolean acceptOutboundMessage(Object msg) throws Exception { return ((msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) == 0) || (msg instanceof ContinuationWebSocketFrame && compressing); }
@Override protected int rsv(WebSocketFrame msg) { return msg.rsv() | WebSocketExtension.RSV1; }
@Override protected int newRsv(WebSocketFrame msg) { return msg.rsv() ^ WebSocketExtension.RSV1; }
@Override protected WebSocketFrame beginAggregation(WebSocketFrame start, ByteBuf content) throws Exception { if (start instanceof TextWebSocketFrame) { return new TextWebSocketFrame(true, start.rsv(), content); } if (start instanceof BinaryWebSocketFrame) { return new BinaryWebSocketFrame(true, start.rsv(), content); } // Should not reach here. throw new Error(); } }
@Override public boolean acceptOutboundMessage(Object msg) throws Exception { return (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame || msg instanceof ContinuationWebSocketFrame) && ((WebSocketFrame) msg).content().readableBytes() > 0 && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) == 0; }
private void onTextFrame0(WebSocketFrame frame) { // faster than frame.text(); String text = Utf8ByteBufCharsetDecoder.decodeUtf8(frame.content()); frame.isFinalFragment(); frame.rsv(); for (WebSocketListener listener : listeners) { listener.onTextFrame(text, frame.isFinalFragment(), frame.rsv()); } }
private void onBinaryFrame0(WebSocketFrame frame) { byte[] bytes = byteBuf2Bytes(frame.content()); for (WebSocketListener listener : listeners) { listener.onBinaryFrame(bytes, frame.isFinalFragment(), frame.rsv()); } }
b0 |= 1 << 7; b0 |= msg.rsv() % 8 << 4; b0 |= opcode % 128;
@Override public boolean acceptOutboundMessage(Object msg) throws Exception { return ((msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) == 0) || (msg instanceof ContinuationWebSocketFrame && compressing); }
@Override public boolean acceptInboundMessage(Object msg) throws Exception { return ((msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0) || (msg instanceof ContinuationWebSocketFrame && compressing); }
@Override public boolean acceptInboundMessage(Object msg) throws Exception { return (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame || msg instanceof ContinuationWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0; }
@Override public boolean acceptInboundMessage(Object msg) throws Exception { return (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame || msg instanceof ContinuationWebSocketFrame) && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) > 0; }
@Override public boolean acceptOutboundMessage(Object msg) throws Exception { return (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame || msg instanceof ContinuationWebSocketFrame) && ((WebSocketFrame) msg).content().readableBytes() > 0 && (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) == 0; }
@Override protected WebSocketFrame beginAggregation(WebSocketFrame start, ByteBuf content) throws Exception { if (start instanceof TextWebSocketFrame) { return new TextWebSocketFrame(true, start.rsv(), content); } if (start instanceof BinaryWebSocketFrame) { return new BinaryWebSocketFrame(true, start.rsv(), content); } // Should not reach here. throw new Error(); } }