Modifier and Type | Field and Description |
---|---|
protected io.netty.channel.Channel |
channel |
Constructor and Description |
---|
NettyWebSocket(io.netty.channel.Channel channel,
io.netty.handler.codec.http.HttpHeaders upgradeHeaders) |
Modifier and Type | Method and Description |
---|---|
WebSocket |
addWebSocketListener(WebSocketListener l)
Add a
WebSocketListener |
void |
bufferFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame) |
java.net.SocketAddress |
getLocalAddress()
Get local address client initiated request from.
|
java.net.SocketAddress |
getRemoteAddress()
Get remote address client initiated request to.
|
io.netty.handler.codec.http.HttpHeaders |
getUpgradeHeaders() |
void |
handleFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame) |
boolean |
isOpen() |
boolean |
isReady() |
void |
onClose(int code,
java.lang.String reason) |
void |
onError(java.lang.Throwable t) |
void |
processBufferedFrames() |
WebSocket |
removeWebSocketListener(WebSocketListener l)
Remove a
WebSocketListener |
io.netty.util.concurrent.Future<java.lang.Void> |
sendBinaryFrame(byte[] payload)
Send a full binary frame.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendBinaryFrame(byte[] payload,
boolean finalFragment,
int rsv)
Allows sending a binary frame with fragmentation or extension bits.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendBinaryFrame(io.netty.buffer.ByteBuf payload,
boolean finalFragment,
int rsv)
Allows sending a binary frame with fragmentation or extension bits.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendCloseFrame()
Send a empty close frame.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendCloseFrame(int statusCode,
java.lang.String reasonText)
Send a empty close frame.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendContinuationFrame(byte[] payload,
boolean finalFragment,
int rsv)
Send a binary continuation frame.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendContinuationFrame(io.netty.buffer.ByteBuf payload,
boolean finalFragment,
int rsv)
Send a continuation frame (those are actually untyped as counterpart must have memorized first fragmented frame type).
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendContinuationFrame(java.lang.String payload,
boolean finalFragment,
int rsv)
Send a text continuation frame.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPingFrame()
Send a empty ping frame
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPingFrame(byte[] payload)
Send a ping frame with a byte array payload (limited to 125 bytes or less).
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPingFrame(io.netty.buffer.ByteBuf payload)
Send a ping frame with a ByteBuf payload (limited to 125 bytes or less).
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPongFrame()
Send a empty pong frame
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPongFrame(byte[] payload)
Send a pong frame with a byte array payload (limited to 125 bytes or less).
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendPongFrame(io.netty.buffer.ByteBuf payload)
Send a pong frame with a ByteBuf payload (limited to 125 bytes or less).
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendTextFrame(io.netty.buffer.ByteBuf payload,
boolean finalFragment,
int rsv)
Allows sending a text frame with fragmentation or extension bits.
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendTextFrame(java.lang.String message)
Send a full text frame
|
io.netty.util.concurrent.Future<java.lang.Void> |
sendTextFrame(java.lang.String payload,
boolean finalFragment,
int rsv)
Allows sending a text frame with fragmentation or extension bits.
|
java.lang.String |
toString() |
public NettyWebSocket(io.netty.channel.Channel channel, io.netty.handler.codec.http.HttpHeaders upgradeHeaders)
public io.netty.handler.codec.http.HttpHeaders getUpgradeHeaders()
getUpgradeHeaders
in interface WebSocket
public java.net.SocketAddress getRemoteAddress()
WebSocket
getRemoteAddress
in interface WebSocket
null
if asynchronous provider is unable to provide the remote addresspublic java.net.SocketAddress getLocalAddress()
WebSocket
getLocalAddress
in interface WebSocket
null
if asynchronous provider is unable to provide the local addresspublic io.netty.util.concurrent.Future<java.lang.Void> sendTextFrame(java.lang.String message)
WebSocket
sendTextFrame
in interface WebSocket
message
- a text payloadpublic io.netty.util.concurrent.Future<java.lang.Void> sendTextFrame(java.lang.String payload, boolean finalFragment, int rsv)
WebSocket
sendTextFrame
in interface WebSocket
payload
- a text fragment.finalFragment
- flag indicating whether or not this is the final fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendTextFrame(io.netty.buffer.ByteBuf payload, boolean finalFragment, int rsv)
WebSocket
sendTextFrame
in interface WebSocket
payload
- a ByteBuf fragment.finalFragment
- flag indicating whether or not this is the final fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendBinaryFrame(byte[] payload)
WebSocket
sendBinaryFrame
in interface WebSocket
payload
- a binary payloadpublic io.netty.util.concurrent.Future<java.lang.Void> sendBinaryFrame(byte[] payload, boolean finalFragment, int rsv)
WebSocket
sendBinaryFrame
in interface WebSocket
payload
- a binary payloadfinalFragment
- flag indicating whether or not this is the last fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendBinaryFrame(io.netty.buffer.ByteBuf payload, boolean finalFragment, int rsv)
WebSocket
sendBinaryFrame
in interface WebSocket
payload
- a ByteBuf payloadfinalFragment
- flag indicating whether or not this is the last fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendContinuationFrame(java.lang.String payload, boolean finalFragment, int rsv)
WebSocket
sendContinuationFrame
in interface WebSocket
payload
- the text fragmentfinalFragment
- flag indicating whether or not this is the last fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendContinuationFrame(byte[] payload, boolean finalFragment, int rsv)
WebSocket
sendContinuationFrame
in interface WebSocket
payload
- the binary fragmentfinalFragment
- flag indicating whether or not this is the last fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendContinuationFrame(io.netty.buffer.ByteBuf payload, boolean finalFragment, int rsv)
WebSocket
sendContinuationFrame
in interface WebSocket
payload
- a ByteBuf fragmentfinalFragment
- flag indicating whether or not this is the last fragmentrsv
- extension bits, 0 otherwisepublic io.netty.util.concurrent.Future<java.lang.Void> sendPingFrame()
WebSocket
sendPingFrame
in interface WebSocket
public io.netty.util.concurrent.Future<java.lang.Void> sendPingFrame(byte[] payload)
WebSocket
sendPingFrame
in interface WebSocket
payload
- the payload.public io.netty.util.concurrent.Future<java.lang.Void> sendPingFrame(io.netty.buffer.ByteBuf payload)
WebSocket
sendPingFrame
in interface WebSocket
payload
- the payload.public io.netty.util.concurrent.Future<java.lang.Void> sendPongFrame()
WebSocket
sendPongFrame
in interface WebSocket
public io.netty.util.concurrent.Future<java.lang.Void> sendPongFrame(byte[] payload)
WebSocket
sendPongFrame
in interface WebSocket
payload
- the payload.public io.netty.util.concurrent.Future<java.lang.Void> sendPongFrame(io.netty.buffer.ByteBuf payload)
WebSocket
sendPongFrame
in interface WebSocket
payload
- the payload.public io.netty.util.concurrent.Future<java.lang.Void> sendCloseFrame()
WebSocket
sendCloseFrame
in interface WebSocket
public io.netty.util.concurrent.Future<java.lang.Void> sendCloseFrame(int statusCode, java.lang.String reasonText)
WebSocket
sendCloseFrame
in interface WebSocket
statusCode
- a status codereasonText
- a reasonpublic boolean isOpen()
public WebSocket addWebSocketListener(WebSocketListener l)
WebSocket
WebSocketListener
addWebSocketListener
in interface WebSocket
l
- a WebSocketListener
public WebSocket removeWebSocketListener(WebSocketListener l)
WebSocket
WebSocketListener
removeWebSocketListener
in interface WebSocket
l
- a WebSocketListener
public boolean isReady()
public void bufferFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
public void processBufferedFrames()
public void handleFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
public void onError(java.lang.Throwable t)
public void onClose(int code, java.lang.String reason)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019. All Rights Reserved.