public class WebSocketClientContext
extends java.lang.Object
WebSocketClient
Modifier and Type | Method and Description |
---|---|
WebSocketClient |
getWebSocketClient()
Get the corresponding WebSocket client.
|
boolean |
isDebugToStdout()
Get if debug information should printed to stdout.
|
void |
printDebug(java.lang.String message)
Print debug information to stdout.
|
long |
sendBinaryFrame(byte[] payload)
Send a binary frame to the server which contains an enabled fin bit.
|
boolean |
sendFrame(Frame frame)
Generic method for sending a frame to the server.
|
long |
sendPingFrame(byte[] payload)
Send a ping frame to the server which contains an enabled fin bit.
|
long |
sendPongFrame(byte[] payload)
Send a pong frame to the server which contains an enabled fin bit.
|
long |
sendTextFrame(java.lang.String payload)
Send a text frame to the server which contains an enabled fin bit.
|
public WebSocketClient getWebSocketClient()
public long sendTextFrame(java.lang.String payload) throws java.io.IOException
payload
- the payload (=text) to sendjava.io.IOException
- if somewhat failspublic long sendBinaryFrame(byte[] payload) throws java.io.IOException
payload
- the binary payload to sendjava.io.IOException
- if somewhat failspublic long sendPingFrame(byte[] payload) throws java.io.IOException
payload
- the payload of the ping, normally use 'new byte[0]'java.io.IOException
- if somewhat failspublic long sendPongFrame(byte[] payload) throws java.io.IOException
payload
- the payload of the pong, normally you should return the received payload of the ping.java.io.IOException
- if somewhat failspublic boolean sendFrame(Frame frame) throws java.io.IOException
frame
- the frame to sendjava.io.IOException
- if somewhat failsFrame.setOpcode(byte)
,
Frame.setPayload(byte[])
,
Frame.setFin(boolean)
public boolean isDebugToStdout()
WebSocketClient.setDebugToStdout()
public void printDebug(java.lang.String message)
message
- the debug messageWebSocketClient.setDebugToStdout()