Http
ws::ConnectionAdapter
WebSocket class which belongs to an HTTP connection.
ConnectionAdapter
#include <websocket.h>
class ConnectionAdapterDefined in src/http/include/icy/http/websocket.h:395
- Inherits
WebSocketAdapter
List of all members
Inherited from WebSocketAdapter
| Kind | Name | Description |
|---|---|---|
friend | WebSocketFramer | |
variable | socket | Pointer to the underlying socket. Sent data will be proxied to this socket. |
function | WebSocketAdapter | Creates a WebSocketAdapter using the given socket, mode and HTTP message objects. |
function | send virtual override | Frames and sends data to the peer's address. |
function | send virtual override | Frames and sends data to a specific peer address (for UDP-backed sockets). |
function | sendOwned virtual override | |
function | sendOwned virtual override | |
function | shutdown virtual | Sends a WebSocket CLOSE frame with the given status code and message, then closes the underlying socket. |
function | sendClientRequest virtual | Client side. |
function | handleClientResponse virtual | Parses the server's HTTP upgrade response and completes the handshake. Any data remaining in the buffer after the HTTP response is re-fed as WebSocket frames. |
function | handleServerRequest virtual | Server side. |
function | onHandshakeComplete virtual | Called when the WebSocket handshake completes. Emits the connect event to downstream handlers. |
variable | framer | |
variable | _request | |
variable | _response | |
variable | _closeState | |
function | ~WebSocketAdapter virtual | |
function | sendControlFrame | |
function | resetFrameState | |
function | onSocketConnect virtual override | Called by the socket on connect; initiates the client handshake. |
function | onSocketRecv virtual override | Called by the socket on each received buffer; handles handshake or frame parsing depending on state. |
function | onSocketClose virtual override | Called by the socket on close; resets framer state. |
Public Methods
| Return | Name | Description |
|---|---|---|
ConnectionAdapter | Creates a ConnectionAdapter for upgrading an existing HTTP connection to WebSocket. Disables automatic header sending on the underlying connection. | |
~ConnectionAdapter virtual | ||
void | onHandshakeComplete virtual | Called when the WebSocket handshake completes. Emits the connect event via the socket emitter chain. |
ConnectionAdapter
ConnectionAdapter(Connection * connection, ws::Mode mode)Defined in src/http/include/icy/http/websocket.h:402
Creates a ConnectionAdapter for upgrading an existing HTTP connection to WebSocket. Disables automatic header sending on the underlying connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
connection | Connection * | The HTTP connection to upgrade. |
mode | ws::Mode | ServerSide or ClientSide. |
~ConnectionAdapter
virtual
virtual ~ConnectionAdapter()Defined in src/http/include/icy/http/websocket.h:403
onHandshakeComplete
virtual
virtual void onHandshakeComplete()Defined in src/http/include/icy/http/websocket.h:407
Called when the WebSocket handshake completes. Emits the connect event via the socket emitter chain.
Reimplements
Protected Attributes
| Return | Name | Description |
|---|---|---|
Connection * | _connection |
_connection
Connection * _connectionDefined in src/http/include/icy/http/websocket.h:410