Package | Description |
---|---|
org.java_websocket | |
org.java_websocket.client |
This package encapsulates all implementations in relation with the WebSocketClient.
|
org.java_websocket.server |
This package encapsulates all implementations in relation with the WebSocketServer.
|
Modifier and Type | Class and Description |
---|---|
class |
WebSocketImpl
Represents one end (client or server) of a single WebSocketImpl connection.
|
Modifier and Type | Method and Description |
---|---|
WebSocket |
WebSocketFactory.createWebSocket(WebSocketAdapter a,
Draft d)
Create a new Websocket with the provided listener, drafts and socket
|
WebSocket |
WebSocketFactory.createWebSocket(WebSocketAdapter a,
List<Draft> drafts)
Create a new Websocket with the provided listener, drafts and socket
|
Modifier and Type | Method and Description |
---|---|
protected abstract Collection<WebSocket> |
AbstractWebSocket.getConnections()
Getter to get all the currently available connections
|
Modifier and Type | Method and Description |
---|---|
InetSocketAddress |
WebSocketListener.getLocalSocketAddress(WebSocket conn) |
InetSocketAddress |
WebSocketListener.getRemoteSocketAddress(WebSocket conn) |
void |
WebSocketListener.onWebsocketClose(WebSocket ws,
int code,
String reason,
boolean remote)
Called after WebSocket#close is explicity called, or when the
other end of the WebSocket connection is closed.
|
void |
WebSocketListener.onWebsocketCloseInitiated(WebSocket ws,
int code,
String reason)
send when this peer sends a close handshake
|
void |
WebSocketListener.onWebsocketClosing(WebSocket ws,
int code,
String reason,
boolean remote)
Called as soon as no further frames are accepted
|
void |
WebSocketListener.onWebsocketError(WebSocket conn,
Exception ex)
Called if an exception worth noting occurred.
|
void |
WebSocketListener.onWebsocketHandshakeReceivedAsClient(WebSocket conn,
ClientHandshake request,
ServerHandshake response)
Called on the client side when the socket connection is first established, and the WebSocketImpl
handshake response has been received.
|
void |
WebSocketAdapter.onWebsocketHandshakeReceivedAsClient(WebSocket conn,
ClientHandshake request,
ServerHandshake response) |
ServerHandshakeBuilder |
WebSocketListener.onWebsocketHandshakeReceivedAsServer(WebSocket conn,
Draft draft,
ClientHandshake request)
Called on the server side when the socket connection is first established, and the WebSocket
handshake has been received.
|
ServerHandshakeBuilder |
WebSocketAdapter.onWebsocketHandshakeReceivedAsServer(WebSocket conn,
Draft draft,
ClientHandshake request)
This default implementation does not do anything.
|
void |
WebSocketListener.onWebsocketHandshakeSentAsClient(WebSocket conn,
ClientHandshake request)
Called on the client side when the socket connection is first established, and the WebSocketImpl
handshake has just been sent.
|
void |
WebSocketAdapter.onWebsocketHandshakeSentAsClient(WebSocket conn,
ClientHandshake request)
This default implementation does not do anything which will cause the connections to always progress.
|
void |
WebSocketListener.onWebsocketMessage(WebSocket conn,
ByteBuffer blob)
Called when an entire binary frame has been received.
|
void |
WebSocketListener.onWebsocketMessage(WebSocket conn,
String message)
Called when an entire text frame has been received.
|
void |
WebSocketListener.onWebsocketMessageFragment(WebSocket conn,
Framedata frame)
Deprecated.
|
void |
WebSocketAdapter.onWebsocketMessageFragment(WebSocket conn,
Framedata frame)
Deprecated.
|
void |
WebSocketListener.onWebsocketOpen(WebSocket conn,
Handshakedata d)
Called after onHandshakeReceived returns true.
|
void |
WebSocketListener.onWebsocketPing(WebSocket conn,
Framedata f)
Called a ping frame has been received.
|
void |
WebSocketAdapter.onWebsocketPing(WebSocket conn,
Framedata f)
This default implementation will send a pong in response to the received ping.
|
void |
WebSocketListener.onWebsocketPong(WebSocket conn,
Framedata f)
Called when a pong frame is received.
|
void |
WebSocketAdapter.onWebsocketPong(WebSocket conn,
Framedata f)
This default implementation does not do anything.
|
void |
WebSocketListener.onWriteDemand(WebSocket conn)
This method is used to inform the selector thread that there is data queued to be written to the socket.
|
Modifier and Type | Class and Description |
---|---|
class |
WebSocketClient
A subclass must implement at least onOpen, onClose, and onMessage to be
useful.
|
Modifier and Type | Method and Description |
---|---|
WebSocket |
WebSocketClient.getConnection()
Getter for the engine
|
Modifier and Type | Method and Description |
---|---|
protected Collection<WebSocket> |
WebSocketClient.getConnections() |
Modifier and Type | Method and Description |
---|---|
InetSocketAddress |
WebSocketClient.getLocalSocketAddress(WebSocket conn) |
InetSocketAddress |
WebSocketClient.getRemoteSocketAddress(WebSocket conn) |
void |
WebSocketClient.onWebsocketClose(WebSocket conn,
int code,
String reason,
boolean remote)
Calls subclass' implementation of onClose.
|
void |
WebSocketClient.onWebsocketCloseInitiated(WebSocket conn,
int code,
String reason) |
void |
WebSocketClient.onWebsocketClosing(WebSocket conn,
int code,
String reason,
boolean remote) |
void |
WebSocketClient.onWebsocketError(WebSocket conn,
Exception ex)
Calls subclass' implementation of onIOError.
|
void |
WebSocketClient.onWebsocketMessage(WebSocket conn,
ByteBuffer blob) |
void |
WebSocketClient.onWebsocketMessage(WebSocket conn,
String message)
Calls subclass' implementation of onMessage.
|
void |
WebSocketClient.onWebsocketMessageFragment(WebSocket conn,
Framedata frame) |
void |
WebSocketClient.onWebsocketOpen(WebSocket conn,
Handshakedata handshake)
Calls subclass' implementation of onOpen.
|
void |
WebSocketClient.onWriteDemand(WebSocket conn) |
Modifier and Type | Method and Description |
---|---|
Collection<WebSocket> |
WebSocketServer.connections()
Deprecated.
|
Collection<WebSocket> |
WebSocketServer.getConnections()
Returns all currently connected clients.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
WebSocketServer.addConnection(WebSocket ws) |
protected void |
WebSocketServer.allocateBuffers(WebSocket c) |
InetSocketAddress |
WebSocketServer.getLocalSocketAddress(WebSocket conn) |
InetSocketAddress |
WebSocketServer.getRemoteSocketAddress(WebSocket conn) |
abstract void |
WebSocketServer.onClose(WebSocket conn,
int code,
String reason,
boolean remote)
Called after the websocket connection has been closed.
|
void |
WebSocketServer.onCloseInitiated(WebSocket conn,
int code,
String reason) |
void |
WebSocketServer.onClosing(WebSocket conn,
int code,
String reason,
boolean remote) |
abstract void |
WebSocketServer.onError(WebSocket conn,
Exception ex)
Called when errors occurs.
|
void |
WebSocketServer.onFragment(WebSocket conn,
Framedata fragment)
Deprecated.
|
void |
WebSocketServer.onMessage(WebSocket conn,
ByteBuffer message)
Callback for binary messages received from the remote host
|
abstract void |
WebSocketServer.onMessage(WebSocket conn,
String message)
Callback for string messages received from the remote host
|
abstract void |
WebSocketServer.onOpen(WebSocket conn,
ClientHandshake handshake)
Called after an opening handshake has been performed and the given websocket is ready to be written on.
|
void |
WebSocketServer.onWebsocketClose(WebSocket conn,
int code,
String reason,
boolean remote) |
void |
WebSocketServer.onWebsocketCloseInitiated(WebSocket conn,
int code,
String reason) |
void |
WebSocketServer.onWebsocketClosing(WebSocket conn,
int code,
String reason,
boolean remote) |
void |
WebSocketServer.onWebsocketError(WebSocket conn,
Exception ex) |
ServerHandshakeBuilder |
WebSocketServer.onWebsocketHandshakeReceivedAsServer(WebSocket conn,
Draft draft,
ClientHandshake request) |
void |
WebSocketServer.onWebsocketMessage(WebSocket conn,
ByteBuffer blob) |
void |
WebSocketServer.onWebsocketMessage(WebSocket conn,
String message) |
void |
WebSocketServer.onWebsocketMessageFragment(WebSocket conn,
Framedata frame)
Deprecated.
|
void |
WebSocketServer.onWebsocketOpen(WebSocket conn,
Handshakedata handshake) |
void |
WebSocketServer.onWriteDemand(WebSocket w) |
protected void |
WebSocketServer.releaseBuffers(WebSocket c) |
protected boolean |
WebSocketServer.removeConnection(WebSocket ws)
This method performs remove operations on the connection and therefore also gives control over whether the operation shall be synchronized
WebSocketServer.WebSocketServer(InetSocketAddress, int, List, Collection) allows to specify a collection which will be used to store current connections in. |
Modifier and Type | Method and Description |
---|---|
void |
WebSocketServer.broadcast(byte[] data,
Collection<WebSocket> clients)
Send a byte array to a specific collection of websocket connections
|
void |
WebSocketServer.broadcast(ByteBuffer data,
Collection<WebSocket> clients)
Send a ByteBuffer to a specific collection of websocket connections
|
void |
WebSocketServer.broadcast(String text,
Collection<WebSocket> clients)
Send a text to a specific collection of websocket connections
|
Constructor and Description |
---|
WebSocketServer(InetSocketAddress address,
int decodercount,
List<Draft> drafts,
Collection<WebSocket> connectionscontainer)
Creates a WebSocketServer that will attempt to bind/listen on the given address,
and comply with Draft version draft.
|
Copyright © 2018. All rights reserved.