The messages of one WebSocket connection (RFC 6455) after the opening handshake: complete text and binary messages in, frames out.
More...
|
| | WsConnection (InputStream in, OutputStream out, boolean client, int maxMessageBytes, SecureRandom random) |
| |
|
long | lastPongNanos () |
| | The time of the last pong, from System#nanoTime(); 0 if none came.
|
| |
|
Message | receive () throws IOException |
| | Blocks for the next complete message.
|
| |
|
void | sendText (String text) throws IOException |
| |
|
void | sendBinary (byte[] data) throws IOException |
| |
|
void | sendPing (byte[] payload) throws IOException |
| |
|
void | close (int code, String reason) throws IOException |
| | Sends a close frame (once) and flushes; the caller closes the streams.
|
| |
|
void | close () throws IOException |
| |
The messages of one WebSocket connection (RFC 6455) after the opening handshake: complete text and binary messages in, frames out.
A subset that is enough for Sendspin and strict about what it reads: no extensions, a size cap for every message and frame, reserved bits and unknown opcodes are errors, a client does not accept masked frames and a server only masked ones, control frames are at most 125 bytes and never fragmented, a text message must be UTF-8, fragments of two messages never interleave. Pings are answered here; a close is answered and ends the connection with a ClosedException; a violation sends a close frame with the matching code and ends it with a ViolationException.
One thread reads (receive()); any thread may send. A SocketTimeoutException from receive() means that nothing arrived and the connection is intact; a timeout inside a frame is a plain IOException (the connection is lost).