Http

ws::ConnectionAdapter

WebSocket class which belongs to an HTTP connection.

ConnectionAdapter

#include <websocket.h>

class ConnectionAdapter

Defined in src/http/include/icy/http/websocket.h:395

List of all members

NameKindOwner
ConnectionAdapterfunctionDeclared here
~ConnectionAdapterfunctionDeclared here
onHandshakeCompletefunctionDeclared here
_connectionvariableDeclared here
WebSocketFramerfriendInherited from WebSocketAdapter
socketvariableInherited from WebSocketAdapter
WebSocketAdapterfunctionInherited from WebSocketAdapter
sendfunctionInherited from WebSocketAdapter
sendfunctionInherited from WebSocketAdapter
sendOwnedfunctionInherited from WebSocketAdapter
sendOwnedfunctionInherited from WebSocketAdapter
shutdownfunctionInherited from WebSocketAdapter
sendClientRequestfunctionInherited from WebSocketAdapter
handleClientResponsefunctionInherited from WebSocketAdapter
handleServerRequestfunctionInherited from WebSocketAdapter
onHandshakeCompletefunctionInherited from WebSocketAdapter
framervariableInherited from WebSocketAdapter
_requestvariableInherited from WebSocketAdapter
_responsevariableInherited from WebSocketAdapter
_closeStatevariableInherited from WebSocketAdapter
~WebSocketAdapterfunctionInherited from WebSocketAdapter
sendControlFramefunctionInherited from WebSocketAdapter
resetFrameStatefunctionInherited from WebSocketAdapter
onSocketConnectfunctionInherited from WebSocketAdapter
onSocketRecvfunctionInherited from WebSocketAdapter
onSocketClosefunctionInherited from WebSocketAdapter

Inherited from WebSocketAdapter

KindNameDescription
friendWebSocketFramer
variablesocketPointer to the underlying socket. Sent data will be proxied to this socket.
functionWebSocketAdapterCreates a WebSocketAdapter using the given socket, mode and HTTP message objects.
functionsend virtual overrideFrames and sends data to the peer's address.
functionsend virtual overrideFrames and sends data to a specific peer address (for UDP-backed sockets).
functionsendOwned virtual override
functionsendOwned virtual override
functionshutdown virtualSends a WebSocket CLOSE frame with the given status code and message, then closes the underlying socket.
functionsendClientRequest virtualClient side.
functionhandleClientResponse virtualParses 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.
functionhandleServerRequest virtualServer side.
functiononHandshakeComplete virtualCalled when the WebSocket handshake completes. Emits the connect event to downstream handlers.
variableframer
variable_request
variable_response
variable_closeState
function~WebSocketAdapter virtual
functionsendControlFrame
functionresetFrameState
functiononSocketConnect virtual overrideCalled by the socket on connect; initiates the client handshake.
functiononSocketRecv virtual overrideCalled by the socket on each received buffer; handles handshake or frame parsing depending on state.
functiononSocketClose virtual overrideCalled by the socket on close; resets framer state.

Public Methods

ReturnNameDescription
ConnectionAdapterCreates a ConnectionAdapter for upgrading an existing HTTP connection to WebSocket. Disables automatic header sending on the underlying connection.
~ConnectionAdapter virtual
voidonHandshakeComplete virtualCalled 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

ParameterTypeDescription
connectionConnection *The HTTP connection to upgrade.
modews::ModeServerSide 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

ReturnNameDescription
Connection *_connection

_connection

Connection * _connection

Defined in src/http/include/icy/http/websocket.h:410