Package com.neovisionaries.ws.client
High-quality WebSocket client implementation in Java. This implementation
- complies with RFC 6455 (The WebSocket Protocol),
- works on Java SE 1.5+ and Android,
- supports all the frame types (continuation, binary, text, close, ping and pong),
- provides a method to send a fragmented frame in addition to methods for unfragmented frames,
- provides a method to get the underlying raw socket of a WebSocket to configure it,
- provides a method for Basic Authentication,
- provides a factory class which utilizes
SocketFactory
interface, - provides a rich listener interface to hook WebSocket events,
- has fine-grained error codes for fine-grained controllability on errors,
- allows to disable validity checks on RSV1/RSV2/RSV3 bits and opcode of frames,
- supports HTTP proxy, especially "Secure WebSocket" (
wss
) through "Secure Proxy" (https
), - and supports RFC 7692 (Compression Extensions for WebSocket), also known as permessage-deflate (not enabled by default).
See the description of WebSocket
class for usage. The source code is hosted at
GitHub.
For Maven:
<dependency> <groupId>com.neovisionaries</groupId> <artifactId>nv-websocket-client</artifactId> <version>2.14</version> </dependency>
- Version:
- 2.14
-
Interface Summary Interface Description PayloadGenerator Payload generator.WebSocketListener Listener interface to receive WebSocket events. -
Class Summary Class Description Address Base64 ByteArray Expandable byte array with byte-basis and bit-basis operations.Connectable An implementation ofCallable
interface that callsWebSocket.connect()
.ConnectThread CounterPayloadGenerator DeflateCompressor DEFLATE (RFC 1951) compressor implementation.DeflateDecompressor DEFLATE (RFC 1951) decompressor implementation from scratch.DeflateUtil Utility methods for DEFLATE (RFC 1951).DistinguishedNameParser A distinguished name (DN) parser.FinishThread FixedDistanceHuffman FixedLiteralLengthHuffman HandshakeBuilder HandshakeReader Reader for a WebSocket opening handshake response.Huffman Huffman coding for DEFLATE format (RFC 1951).ListenerManager Misc OkHostnameVerifier A HostnameVerifier consistent with RFC 2818.PeriodicalFrameSender PerMessageCompressionExtension Per-Message Compression Extension (RFC 7692).PerMessageDeflateExtension Per-Message Deflate Extension (7. The "permessage-deflate" Extension in RFC 7692).PingSender PongSender ProxyHandshaker ProxySettings Proxy settings.ReadingThread SNIHelper SocketConnector A class to connect to the server.SocketFactorySettings SocketInitiator Lets multiple sockets race the given IP addresses until one has been established.StateManager StatusLine HTTP status line returned from an HTTP server.Token WebSocket WebSocket.WebSocketAdapter An empty implementation ofWebSocketListener
interface.WebSocketCloseCode Close code.WebSocketExtension A class to hold the name and the parameters of a WebSocket extension.WebSocketFactory Factory to createWebSocket
instances.WebSocketFrame WebSocket frame.WebSocketInputStream WebSocketOpcode Opcode.WebSocketOutputStream WebSocketThread WritingThread -
Enum Summary Enum Description DualStackMode The dual stack mode defines which IP address families will be used to establish a connection.StateManager.CloseInitiator ThreadType Types of threads which are created internally in the implementation.WebSocketError WebSocket error codes.WebSocketState WebSocket state. -
Exception Summary Exception Description FormatException HostnameUnverifiedException The certificate of the peer does not match the expected hostname.InsufficientDataException NoMoreFrameException OpeningHandshakeException An exception raised due to a violation against the WebSocket protocol.WebSocketException WebSocket exception.