public class DefaultWebSocketConnection extends Object implements WebSocketConnection
WebSocketConnection.| Constructor and Description |
|---|
DefaultWebSocketConnection(io.netty.channel.ChannelHandlerContext ctx,
WebSocketInboundFrameHandler frameHandler,
WebSocketMessageQueueHandler webSocketMessageQueueHandler,
boolean secure,
String negotiatedSubProtocol) |
| Modifier and Type | Method and Description |
|---|---|
io.netty.channel.ChannelFuture |
finishConnectionClosure()
Finish the connection closure if a close frame has been received without this connection sending a close frame.
|
io.netty.channel.ChannelFuture |
finishConnectionClosure(int statusCode,
String reason)
Finish the connection closure if a close frame has been received without this connection sending a close frame.
|
String |
getChannelId()
Retrieve the Channel ID of the connection.
|
String |
getHost()
Retrieve the host of the connection.
|
String |
getNegotiatedSubProtocol()
Retrieve the negotiated sub-protocol during WebSocket handshake.
|
int |
getPort()
Retrieve the port of the connection.
|
io.netty.channel.ChannelFuture |
initiateConnectionClosure()
Initiates connection closure.
|
io.netty.channel.ChannelFuture |
initiateConnectionClosure(int statusCode,
String reason)
Initiates connection closure.
|
boolean |
isOpen()
Check if the connection is open.
|
boolean |
isSecure()
Check if the connection is secure.
|
io.netty.channel.ChannelFuture |
ping(ByteBuffer data)
Ping remote endpoint asynchronously.
|
io.netty.channel.ChannelFuture |
pong(ByteBuffer data)
Send pong to remote endpoint asynchronously.
|
io.netty.channel.ChannelFuture |
pushBinary(ByteBuffer data)
Push binary frame to the WebSocket connection asynchronously.
|
io.netty.channel.ChannelFuture |
pushBinary(ByteBuffer data,
boolean finalFrame)
Push binary frame to the WebSocket connection asynchronously.
|
io.netty.channel.ChannelFuture |
pushText(String text)
Push text frame to the WebSocket connection asynchronously.
|
io.netty.channel.ChannelFuture |
pushText(String text,
boolean finalFrame)
Push text frame to the WebSocket connection asynchronously.
|
void |
readNextFrame()
Reading WebSocket frames after successful handshake is blocked by default in transport level.
|
void |
startReadingFrames()
Reading WebSocket frames after successful handshake is blocked by default in transport level.
|
void |
stopReadingFrames()
Stop reading WebSocket frames from the wire.
|
io.netty.channel.ChannelFuture |
terminateConnection()
Terminate connection without close frame.
|
io.netty.channel.ChannelFuture |
terminateConnection(int statusCode,
String reason)
Send a close frame and close the connection without waiting for a response.
|
public DefaultWebSocketConnection(io.netty.channel.ChannelHandlerContext ctx,
WebSocketInboundFrameHandler frameHandler,
WebSocketMessageQueueHandler webSocketMessageQueueHandler,
boolean secure,
String negotiatedSubProtocol)
public String getChannelId()
WebSocketConnectiongetChannelId in interface WebSocketConnectionpublic boolean isOpen()
WebSocketConnectionisOpen in interface WebSocketConnectionpublic boolean isSecure()
WebSocketConnectionisSecure in interface WebSocketConnectionpublic String getHost()
WebSocketConnectiongetHost in interface WebSocketConnectionpublic int getPort()
WebSocketConnectiongetPort in interface WebSocketConnectionpublic String getNegotiatedSubProtocol()
WebSocketConnectiongetNegotiatedSubProtocol in interface WebSocketConnectionpublic void readNextFrame()
WebSocketConnectionreadNextFrame in interface WebSocketConnectionpublic void startReadingFrames()
WebSocketConnectionstartReadingFrames in interface WebSocketConnectionpublic void stopReadingFrames()
WebSocketConnectionstopReadingFrames in interface WebSocketConnectionpublic io.netty.channel.ChannelFuture pushText(String text)
WebSocketConnectionpushText in interface WebSocketConnectiontext - text to be sentpublic io.netty.channel.ChannelFuture pushText(String text, boolean finalFrame)
WebSocketConnectionpushText in interface WebSocketConnectiontext - text to be sentfinalFrame - true if sending final framepublic io.netty.channel.ChannelFuture pushBinary(ByteBuffer data)
WebSocketConnectionpushBinary in interface WebSocketConnectiondata - binary data to be sentpublic io.netty.channel.ChannelFuture pushBinary(ByteBuffer data, boolean finalFrame)
WebSocketConnectionpushBinary in interface WebSocketConnectiondata - binary data to be sentfinalFrame - true if sending final framepublic io.netty.channel.ChannelFuture ping(ByteBuffer data)
WebSocketConnectionping in interface WebSocketConnectiondata - data to be sent with ping framepublic io.netty.channel.ChannelFuture pong(ByteBuffer data)
WebSocketConnectionpong in interface WebSocketConnectiondata - data to be sent with ping framepublic io.netty.channel.ChannelFuture initiateConnectionClosure(int statusCode,
String reason)
WebSocketConnectionChannelFuture will complete operation successfully if and only if it
receives back a echoed close WebSocket frame from the remote endpoint with the same status code as was written.
Also ChannelFuture will not reach operationComplete state until it receives a close WebSocket frame
from the remote endpoint. If user does not need to wait for the echoed back WebSocket frame from the remote
endpoint, user need to handle it separately.initiateConnectionClosure in interface WebSocketConnectionstatusCode - Status code to indicate the reason of closurereason - Reason to close the connectionpublic io.netty.channel.ChannelFuture initiateConnectionClosure()
WebSocketConnectionChannelFuture will complete operation successfully if and only if it
receives back a echoed close WebSocket frame from the remote endpoint with the same status code as was written.
Also ChannelFuture will not reach operationComplete state until it receives a close WebSocket frame from
the remote endpoint. If user does not need to wait for the echoed back WebSocket frame from the remote endpoint,
user need to handle it separately.initiateConnectionClosure in interface WebSocketConnectionpublic io.netty.channel.ChannelFuture finishConnectionClosure(int statusCode,
String reason)
WebSocketConnectionfinishConnectionClosure in interface WebSocketConnectionstatusCode - Status code to indicate the reason of closurereason - Reason to close the connectionpublic io.netty.channel.ChannelFuture finishConnectionClosure()
WebSocketConnectionfinishConnectionClosure in interface WebSocketConnectionpublic io.netty.channel.ChannelFuture terminateConnection()
WebSocketConnectionterminateConnection in interface WebSocketConnectionpublic io.netty.channel.ChannelFuture terminateConnection(int statusCode,
String reason)
WebSocketConnectionterminateConnection in interface WebSocketConnectionstatusCode - Status code to indicate the reason of closurereason - Reason to close the connectionCopyright © 2022 WSO2. All rights reserved.