Package org.jboss.netty.handler.codec.http.websocket

Examples of org.jboss.netty.handler.codec.http.websocket.DefaultWebSocketFrame


    }

    private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
        // Send the uppercased string back.
        ctx.getChannel().write(
                new DefaultWebSocketFrame(frame.getTextData().toUpperCase()));
    }
View Full Code Here


        
         StompFrame frame = decoder.decode(buffer);
        
         if (frame != null)
         {
            WebSocketFrame wsFrame = new DefaultWebSocketFrame(frame.asString());

            // Text frame
            ChannelBuffer data = wsFrame.getBinaryData();
            ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(),
                                                                                     data.readableBytes() + 2);
            encoded.writeByte((byte)wsFrame.getType());
            encoded.writeBytes(data, data.readableBytes());
            encoded.writeByte((byte)0xFF);
            return encoded;

         }
View Full Code Here

         StompFrame frame = decoder.decode(buffer);

         if (frame != null)
         {
            WebSocketFrame wsFrame = new DefaultWebSocketFrame(frame.asString());

            // Text frame
            ChannelBuffer data = wsFrame.getBinaryData();
            ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(),
                                                                                     data.readableBytes() + 2);
            encoded.writeByte((byte)wsFrame.getType());
            encoded.writeBytes(data, data.readableBytes());
            encoded.writeByte((byte)0xFF);
            return encoded;

         }
View Full Code Here

    @Override
    public NettyWebSocketConnection send(String message) {
        if (hybi) {
            return write(new EncodingHybiFrame(Opcodes.OPCODE_TEXT, true, 0, ChannelBuffers.copiedBuffer(message, CharsetUtil.UTF_8)));
        } else {
            return write(new DefaultWebSocketFrame(message));
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.http.websocket.DefaultWebSocketFrame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.