Skip navigation links

Package org.apache.hc.client5.http.websocket

Client-side WebSocket support built on top of Apache HttpClient.

See: Description

Package org.apache.hc.client5.http.websocket Description

Client-side WebSocket support built on top of Apache HttpClient.

This package provides the public API for establishing and using WebSocket connections according to RFC 6455. WebSocket sessions are created by upgrading an HTTP request and are backed internally by the non-blocking I/O reactor used by the HttpClient async APIs.

Experimental. This module is experimental. Its public API is not yet stable and may change in an incompatible way, or be removed, in a future release; it is excluded from the project's binary and source backward-compatibility guarantees for the 5.7 release series.

Core abstractions

Threading model

Outbound operations on WebSocket are thread-safe and may be invoked from arbitrary application threads. Inbound callbacks on WebSocketListener are normally executed on I/O dispatcher threads; listeners should avoid long blocking operations.

Close handshake

The implementation follows the close handshake defined in RFC 6455. Applications should initiate shutdown via WebSocket.close(int, String) and treat receipt of a close frame as a terminal event. The configured closeWaitTimeout controls how long the client will wait for the peer's close frame before the underlying connection is closed.

Classes in org.apache.hc.core5.websocket subpackages and org.apache.hc.client5.http.websocket.transport are internal implementation details and are not intended for direct use.

Since:
5.7
Skip navigation links

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.