org.webbitserver.netty
Class NettyWebSocketConnection

java.lang.Object
  extended by org.webbitserver.netty.AbstractHttpConnection
      extended by org.webbitserver.netty.NettyWebSocketConnection
All Implemented Interfaces:
Executor, DataHolder, HttpConnection, WebSocketConnection

public class NettyWebSocketConnection
extends AbstractHttpConnection
implements WebSocketConnection


Constructor Summary
NettyWebSocketConnection(Executor executor, NettyHttpRequest nettyHttpRequest, org.jboss.netty.channel.ChannelHandlerContext ctx, byte[] outboundMaskingKey)
           
 
Method Summary
 NettyWebSocketConnection close()
           
 NettyWebSocketConnection data(String key, Object value)
          Store data value by key.
 NettyWebSocketConnection ping(byte[] message)
          Sends a ping frame
 NettyWebSocketConnection pong(byte[] message)
          Sends a pong frame
 NettyWebSocketConnection send(byte[] message)
          Sends a binary frame
 NettyWebSocketConnection send(byte[] message, int offset, int length)
          Sends a binary frame
 NettyWebSocketConnection send(String message)
          Sends a text frame
 void setHybiWebSocketVersion(int webSocketVersion)
           
 String version()
           
 
Methods inherited from class org.webbitserver.netty.AbstractHttpConnection
closeChannel, data, data, dataKeys, execute, handlerExecutor, httpRequest, putData, writeMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.webbitserver.HttpConnection
handlerExecutor, httpRequest
 
Methods inherited from interface java.util.concurrent.Executor
execute
 
Methods inherited from interface org.webbitserver.DataHolder
data, data, dataKeys
 

Constructor Detail

NettyWebSocketConnection

public NettyWebSocketConnection(Executor executor,
                                NettyHttpRequest nettyHttpRequest,
                                org.jboss.netty.channel.ChannelHandlerContext ctx,
                                byte[] outboundMaskingKey)
Method Detail

send

public NettyWebSocketConnection send(String message)
Description copied from interface: WebSocketConnection
Sends a text frame

Specified by:
send in interface WebSocketConnection
Parameters:
message - frame payload
Returns:
this

send

public NettyWebSocketConnection send(byte[] message)
Description copied from interface: WebSocketConnection
Sends a binary frame

Specified by:
send in interface WebSocketConnection
Parameters:
message - frame payload
Returns:
this

send

public NettyWebSocketConnection send(byte[] message,
                                     int offset,
                                     int length)
Description copied from interface: WebSocketConnection
Sends a binary frame

Specified by:
send in interface WebSocketConnection
Parameters:
message - frame payload
offset - The offset within the array of the first byte to be written; must be non-negative and no larger than message.length
length - The maximum number of bytes to be written to the given array; must be non-negative and no larger than message.length - offset
Returns:
this

ping

public NettyWebSocketConnection ping(byte[] message)
Description copied from interface: WebSocketConnection
Sends a ping frame

Specified by:
ping in interface WebSocketConnection
Parameters:
message - the payload of the ping
Returns:
this

pong

public NettyWebSocketConnection pong(byte[] message)
Description copied from interface: WebSocketConnection
Sends a pong frame

Specified by:
pong in interface WebSocketConnection
Parameters:
message - the payload of the ping
Returns:
this

close

public NettyWebSocketConnection close()
Specified by:
close in interface HttpConnection
Specified by:
close in interface WebSocketConnection

data

public NettyWebSocketConnection data(String key,
                                     Object value)
Description copied from interface: DataHolder
Store data value by key.

Specified by:
data in interface DataHolder
Specified by:
data in interface WebSocketConnection
See Also:
DataHolder.data()

version

public String version()
Specified by:
version in interface WebSocketConnection
Returns:
the WebSocket protocol version

setHybiWebSocketVersion

public void setHybiWebSocketVersion(int webSocketVersion)


Copyright © 2012. All Rights Reserved.