Http

ws::WebSocket

Standalone WebSocket class.

WebSocket

#include <websocket.h>

class WebSocket

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

List of all members

NameKindOwner
WebSocketfunctionDeclared here
~WebSocketfunctionDeclared here
requestfunctionDeclared here
responsefunctionDeclared here
_requestvariableDeclared here
_responsevariableDeclared here
VectypedefDeclared 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
WebSocketCreates the WebSocket with the given Socket. The Socket should be a TCPSocket or a SSLSocket, depending on the protocol used (ws or wss).
~WebSocket virtual
http::Request &request nodiscardReturns the HTTP request used during the WebSocket handshake.
http::Response &response nodiscardReturns the HTTP response received during the WebSocket handshake.

WebSocket

WebSocket(const net::Socket::Ptr & socket)

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

Creates the WebSocket with the given Socket. The Socket should be a TCPSocket or a SSLSocket, depending on the protocol used (ws or wss).


~WebSocket

virtual

virtual ~WebSocket()

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


request

nodiscard

[[nodiscard]] http::Request & request()

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

Returns the HTTP request used during the WebSocket handshake.


response

nodiscard

[[nodiscard]] http::Response & response()

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

Returns the HTTP response received during the WebSocket handshake.

Protected Attributes

ReturnNameDescription
http::Request_request
http::Response_response

_request

http::Request _request

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


_response

http::Response _response

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

Public Types

NameDescription
Vec

Vec

using Vec = std::vector< WebSocket >

Type: std::vector< WebSocket >

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