| Modifier and Type | Field and Description |
|---|---|
| private Object | attachment
Attribute to store connection attachment |
| private ByteChannel | |
| private Integer | |
| private Boolean | |
| private String | |
| public static final int | DEFAULT_PORT
The default port of WebSockets, as defined in the spec. |
| public static final int | DEFAULT_WSS_PORT
The default wss port of WebSockets, as defined in the spec. |
| private Draft | draft
The draft which is used by this websocket |
| private boolean | flushandclosestate
When true no further frames may be submitted to be sent |
| private ClientHandshake | handshakerequest
stores the handshake sent by this websocket ( Role.CLIENT only ) |
| public final BlockingQueue | inQueue
Queue of buffers that need to be processed |
| private SelectionKey | |
| private List | knownDrafts
A list of drafts available for this websocket |
| private long | lastPong
Attribute, when the last pong was received |
| private final Logger | log
Logger instance |
| public final BlockingQueue | outQueue
Queue of buffers that need to be sent to the client. |
| private volatile ReadyState | readyState
The current state of the connection |
| private String | |
| private Role | role
The role which this websocket takes in the connection |
| private final Object | synchronizeWriteObject
Attribut to synchronize the write |
| private ByteBuffer | tmpHandshakeBytes
the bytes of an incomplete received handshake |
| private WebSocketServer. | workerThread
Helper variable meant to store the thread which ( exclusively ) triggers this objects decode method. |
| private final WebSocketListener | wsl
The listener to notify of WebSocket events. |
| Access | Constructor and Description |
|---|---|
| public | WebSocketImpl(WebSocketListener
The listener for this instance listener, List<Draft> The drafts which should be used drafts)Creates a websocket with server role |
| public | WebSocketImpl(WebSocketListener
The listener for this instance listener, Draft The draft which should be used draft)creates a websocket with client role |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public void | close(int code, String message)
Implements org. sends the closing handshake. |
| public void | |
| public void | |
| public void | close()
Implements org. Convenience function which behaves like close(CloseFrame.NORMAL) |
| public synchronized void | closeConnection(int
the closing code code, String the closing message message, boolean Indicates who "generated" remote)code.true means that this endpoint received the code from
the other endpoint.false means this endpoint decided to send the given code, remote may also be true if this endpoint started the closing
handshake since the other endpoint may not simply echo the code but
close the connection the same time this endpoint does do but with an other
code. This will close the connection immediately without a proper close handshake. |
| protected void | |
| public void | |
| public void | closeConnection(int code, String message)
Implements org. This will close the connection immediately without a proper close handshake. |
| private void | closeConnectionDueToInternalServerError(RuntimeException
the RuntimeException causing this problem exception)Close the connection if there was a server error by a RuntimeException |
| private void | closeConnectionDueToWrongHandshake(InvalidDataException
the InvalidDataException causing this problem exception)Close the connection if the received handshake was not correct |
| public void | |
| private void | |
| private boolean | |
| public void | |
| public synchronized void | |
| private ByteBuffer | Returns: the complete response as ByteBufferthe http error code errorCode)Generate a simple response for the corresponding endpoint to indicate some error |
| public <T> T | getAttachment()
Implements org. Getter for the connection attachment. |
| public ByteChannel | |
| public Draft | |
| pack-priv long | |
| public InetSocketAddress | getLocalSocketAddress()
Implements org. Returns the address of the endpoint this socket is bound to, or |
| public IProtocol | getProtocol()
Implements org. Returns the used Sec-WebSocket-Protocol for this websocket connection |
| public ReadyState | getReadyState()
Implements org. Retrieve the WebSocket 'ReadyState'. |
| public InetSocketAddress | getRemoteSocketAddress()
Implements org. Returns the address of the endpoint this socket is connected to, or |
| public String | getResourceDescriptor()
Implements org. Returns the HTTP Request-URI as defined by http://tools.ietf.org/html/rfc2616#section-5.1.2 If the opening handshake has not yet happened it will return null. |
| public SelectionKey | |
| public SSLSession | getSSLSession()
Implements org. Returns the ssl session of websocket, if ssl/wss is used for this instance. |
| public WebSocketListener | Returns: the websocket listener associated with this instanceGetter for the websocket listener |
| public WebSocketServer. | |
| public boolean | hasBufferedData()
Implements org. Checks if the websocket has buffered data |
| public boolean | hasSSLSupport()
Implements org. Does this websocket use an encrypted (wss/ssl) or unencrypted (ws) connection |
| public boolean | |
| public boolean | |
| public boolean | isFlushAndClose()
Implements org. Returns true when no further frames may be submitted This happens before the socket connection is closed. |
| public boolean | |
| private void | |
| public void | |
| public void | send(ByteBuffer bytes)
Implements org. Send Binary data (plain bytes) to the other end. |
| public void | send(byte[] bytes)
Implements org. Send Binary data (plain bytes) to the other end. |
| private void | |
| public void | sendFragmentedFrame(Opcode op, ByteBuffer buffer, boolean fin)
Implements org. Allows to send continuous/fragmented frames conveniently. |
| public void | sendFrame(Collection<Framedata> frames)
Implements org. Send a collection of frames to the other end |
| public void | sendFrame(Framedata framedata)
Implements org. Send a frame to the other end |
| public void | |
| public <T> void | setAttachment(T attachment)
Implements org. Setter for an attachment on the socket connection. |
| public void | |
| public void | |
| public void | |
| public void | |
| public String | |
| public void | |
| private void | |
| private void | write(List<ByteBuffer>
the list of bytebuffer bufs)Write a list of bytebuffer (frames in binary form) into the outgoing queue |
| attachment | back to summary |
|---|---|
| private Object attachment Attribute to store connection attachment
| |
| channel | back to summary |
|---|---|
| private ByteChannel channel the possibly wrapped channel object whose selection is controlled by | |
| closecode | back to summary |
|---|---|
| private Integer closecode | |
| closedremotely | back to summary |
|---|---|
| private Boolean closedremotely | |
| closemessage | back to summary |
|---|---|
| private String closemessage | |
| DEFAULT_PORT | back to summary |
|---|---|
| public static final int DEFAULT_PORT The default port of WebSockets, as defined in the spec. If the nullary constructor is used, DEFAULT_PORT will be the port the WebSocketServer is binded to. Note that ports under 1024 usually require root permissions. | |
| DEFAULT_WSS_PORT | back to summary |
|---|---|
| public static final int DEFAULT_WSS_PORT The default wss port of WebSockets, as defined in the spec. If the nullary constructor is used, DEFAULT_WSS_PORT will be the port the WebSocketServer is binded to. Note that ports under 1024 usually require root permissions. | |
| draft | back to summary |
|---|---|
| private Draft draft The draft which is used by this websocket | |
| flushandclosestate | back to summary |
|---|---|
| private boolean flushandclosestate When true no further frames may be submitted to be sent | |
| handshakerequest | back to summary |
|---|---|
| private ClientHandshake handshakerequest stores the handshake sent by this websocket ( Role.CLIENT only ) | |
| inQueue | back to summary |
|---|---|
| public final BlockingQueue<ByteBuffer> inQueue Queue of buffers that need to be processed | |
| key | back to summary |
|---|---|
| private SelectionKey key | |
| knownDrafts | back to summary |
|---|---|
| private List<Draft> knownDrafts A list of drafts available for this websocket | |
| lastPong | back to summary |
|---|---|
| private long lastPong Attribute, when the last pong was received | |
| log | back to summary |
|---|---|
| private final Logger log Logger instance
| |
| outQueue | back to summary |
|---|---|
| public final BlockingQueue<ByteBuffer> outQueue Queue of buffers that need to be sent to the client. | |
| readyState | back to summary |
|---|---|
| private volatile ReadyState readyState The current state of the connection | |
| resourceDescriptor | back to summary |
|---|---|
| private String resourceDescriptor | |
| role | back to summary |
|---|---|
| private Role role The role which this websocket takes in the connection | |
| synchronizeWriteObject | back to summary |
|---|---|
| private final Object synchronizeWriteObject Attribut to synchronize the write | |
| tmpHandshakeBytes | back to summary |
|---|---|
| private ByteBuffer tmpHandshakeBytes the bytes of an incomplete received handshake | |
| workerThread | back to summary |
|---|---|
| private WebSocketServer. Helper variable meant to store the thread which ( exclusively ) triggers this objects decode method. | |
| wsl | back to summary |
|---|---|
| private final WebSocketListener wsl The listener to notify of WebSocket events. | |
| WebSocketImpl | back to summary |
|---|---|
| public WebSocketImpl(WebSocketListener listener, List<Draft> drafts) Creates a websocket with server role
| |
| WebSocketImpl | back to summary |
|---|---|
| public WebSocketImpl(WebSocketListener listener, Draft draft) creates a websocket with client role
| |
| close | back to summary |
|---|---|
| public synchronized void close(int code, String message, boolean remote) | |
| close | back to summary |
|---|---|
| public void close(int code, String message) Implements org. Doc from org. sends the closing handshake. may be send in response to an other handshake.
| |
| close | back to summary |
|---|---|
| public void close(int code) Implements org. Doc from org. sends the closing handshake. may be send in response to an other handshake.
| |
| close | back to summary |
|---|---|
| public void close(InvalidDataException e) | |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from org. Convenience function which behaves like close(CloseFrame.NORMAL)
| |
| closeConnection | back to summary |
|---|---|
| public synchronized void closeConnection(int code, String message, boolean remote) This will close the connection immediately without a proper close handshake. The code and the message therefore won't be transferred over the wire also they will be forwarded to onClose/onWebsocketClose.
| |
| closeConnection | back to summary |
|---|---|
| protected void closeConnection(int code, boolean remote) | |
| closeConnection | back to summary |
|---|---|
| public void closeConnection() | |
| closeConnection | back to summary |
|---|---|
| public void closeConnection(int code, String message) Implements org. Doc from org. This will close the connection immediately without a proper close handshake. The code and the message therefore won't be transferred over the wire also they will be forwarded to onClose/onWebsocketClose. | |
| closeConnectionDueToInternalServerError | back to summary |
|---|---|
| private void closeConnectionDueToInternalServerError(RuntimeException exception) Close the connection if there was a server error by a RuntimeException
| |
| closeConnectionDueToWrongHandshake | back to summary |
|---|---|
| private void closeConnectionDueToWrongHandshake(InvalidDataException exception) Close the connection if the received handshake was not correct
| |
| decode | back to summary |
|---|---|
| public void decode(ByteBuffer socketBuffer) Method to decode the provided ByteBuffer
| |
| decodeFrames | back to summary |
|---|---|
| private void decodeFrames(ByteBuffer socketBuffer) | |
| decodeHandshake | back to summary |
|---|---|
| private boolean decodeHandshake(ByteBuffer socketBufferNew) Returns whether the handshake phase has is completed. In case of a broken handshake this will be never the case. | |
| eot | back to summary |
|---|---|
| public void eot() | |
| flushAndClose | back to summary |
|---|---|
| public synchronized void flushAndClose(int code, String message, boolean remote) | |
| generateHttpResponseDueToError | back to summary |
|---|---|
| private ByteBuffer generateHttpResponseDueToError(int errorCode) Generate a simple response for the corresponding endpoint to indicate some error
| |
| getAttachment | back to summary |
|---|---|
| public <T> T getAttachment() Implements org. Doc from org. Getter for the connection attachment.
| |
| getChannel | back to summary |
|---|---|
| public ByteChannel getChannel() | |
| getDraft | back to summary |
|---|---|
| public Draft getDraft() Implements org. Doc from org. Getter for the draft
| |
| getLastPong | back to summary |
|---|---|
| pack-priv long getLastPong() Getter for the last pong received
| |
| getLocalSocketAddress | back to summary |
|---|---|
| public InetSocketAddress getLocalSocketAddress() Implements org. Doc from org. Returns the address of the endpoint this socket is bound to, or
| |
| getProtocol | back to summary |
|---|---|
| public IProtocol getProtocol() Implements org. Doc from org. Returns the used Sec-WebSocket-Protocol for this websocket connection
| |
| getReadyState | back to summary |
|---|---|
| public ReadyState getReadyState() Implements org. Doc from org. Retrieve the WebSocket 'ReadyState'. This represents the state of the connection. It returns a numerical value, as per W3C WebSockets specs.
| |
| getRemoteSocketAddress | back to summary |
|---|---|
| public InetSocketAddress getRemoteSocketAddress() Implements org. Doc from org. Returns the address of the endpoint this socket is connected to, or
| |
| getResourceDescriptor | back to summary |
|---|---|
| public String getResourceDescriptor() Implements org. Doc from org. Returns the HTTP Request-URI as defined by http://tools.ietf.org/html/rfc2616#section-5.1.2
| |
| getSelectionKey | back to summary |
|---|---|
public SelectionKey getSelectionKey()
| |
| getSSLSession | back to summary |
|---|---|
| public SSLSession getSSLSession() Implements org. Doc from org. Returns the ssl session of websocket, if ssl/wss is used for this instance.
| |
| getWebSocketListener | back to summary |
|---|---|
| public WebSocketListener getWebSocketListener() Getter for the websocket listener
| |
| getWorkerThread | back to summary |
|---|---|
| public WebSocketServer. | |
| hasBufferedData | back to summary |
|---|---|
| public boolean hasBufferedData() Implements org. Doc from org. Checks if the websocket has buffered data
| |
| hasSSLSupport | back to summary |
|---|---|
| public boolean hasSSLSupport() Implements org. Doc from org. Does this websocket use an encrypted (wss/ssl) or unencrypted (ws) connection
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements org. Doc from org. Is the websocket in the state CLOSED
| |
| isClosing | back to summary |
|---|---|
| public boolean isClosing() Implements org. Doc from org. Is the websocket in the state CLOSING
| |
| isFlushAndClose | back to summary |
|---|---|
| public boolean isFlushAndClose() Implements org. Doc from org. Returns true when no further frames may be submitted
| |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements org. Doc from org. Is the websocket in the state OPEN
| |
| open | back to summary |
|---|---|
| private void open(Handshakedata d) | |
| send | back to summary |
|---|---|
| public void send(String text) Implements org. Send Text data to the other end.
| |
| send | back to summary |
|---|---|
| public void send(ByteBuffer bytes) Implements org. Send Binary data (plain bytes) to the other end.
| |
| send | back to summary |
|---|---|
| public void send(byte[] bytes) Implements org. Doc from org. Send Binary data (plain bytes) to the other end.
| |
| send | back to summary |
|---|---|
| private void send(Collection<Framedata> frames) | |
| sendFragmentedFrame | back to summary |
|---|---|
| public void sendFragmentedFrame(Opcode op, ByteBuffer buffer, boolean fin) Implements org. Doc from org. Allows to send continuous/fragmented frames conveniently. If the first frame you send is also the last then it is not a fragmented frame and will received via onMessage instead of onFragmented even though it was send by this method.
| |
| sendFrame | back to summary |
|---|---|
| public void sendFrame(Collection<Framedata> frames) Implements org. Doc from org. Send a collection of frames to the other end
| |
| sendFrame | back to summary |
|---|---|
| public void sendFrame(Framedata framedata) Implements org. Doc from org. Send a frame to the other end
| |
| sendPing | back to summary |
|---|---|
| public void sendPing() throws NullPointerException Implements org. Doc from org. Send a ping to the other end | |
| setAttachment | back to summary |
|---|---|
| public <T> void setAttachment(T attachment) Implements org. Doc from org. Setter for an attachment on the socket connection. The attachment may be of any type.
| |
| setChannel | back to summary |
|---|---|
| public void setChannel(ByteChannel channel) | |
| setSelectionKey | back to summary |
|---|---|
public void setSelectionKey(SelectionKey key)
| |
| setWorkerThread | back to summary |
|---|---|
| public void setWorkerThread(WebSocketServer. | |
| startHandshake | back to summary |
|---|---|
| public void startHandshake(ClientHandshakeBuilder handshakedata) throws InvalidHandshakeException | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| updateLastPong | back to summary |
|---|---|
| public void updateLastPong() Update the timestamp when the last pong was received | |
| write | back to summary |
|---|---|
| private void write(ByteBuffer buf) | |
| write | back to summary |
|---|---|
| private void write(List<ByteBuffer> bufs) Write a list of bytebuffer (frames in binary form) into the outgoing queue
| |