cohtml::IClientSideSocket
The IClientSideSocket represents platform/client specific part of the web sockets.
#include <Socket.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| IClientSideSocket() | |
| virtual | ~IClientSideSocket() |
| virtual void | Send(const char * bytes, unsigned length) Called when the JS web socket want to send text data to the server. |
| virtual void | Send(const char * bytes, unsigned length, cohtml::websocket::OpCode opCode) Called when the JS web socket want to send binary or text data to the server. |
| virtual unsigned | GetBufferedAmount() Called when the JS web socket want to get buffered amount of data. |
| virtual const char * | GetProtocol() Called when the JS web socket want to name of the sub-protocol the server selected. |
| virtual void | Close(unsigned code, const char * reason, unsigned length) Called when the JS web socket want to close the connection with server. |
| virtual void | Terminate(unsigned code, const char * reason, unsigned length) Called when the JS web socket will no longer will call IClientSideSocket and now is safe to destroy this object. The method must close the connection to the server and also it’s no longer safe to use a. |
Public Functions Documentation
Section titled “Public Functions Documentation”function IClientSideSocket
Section titled “function IClientSideSocket”IClientSideSocket()function ~IClientSideSocket
Section titled “function ~IClientSideSocket”virtual ~IClientSideSocket()function Send
Section titled “function Send”inline virtual void Send( const char * bytes, unsigned length)Called when the JS web socket want to send text data to the server.
Parameters:
- bytes text data which is send to the server
- length the length in bytes of the data
Warning: Will be deprecated, implement IClientSideSocket::Send/3 instead.
function Send
Section titled “function Send”inline virtual void Send( const char * bytes, unsigned length, cohtml::websocket::OpCode opCode)Called when the JS web socket want to send binary or text data to the server.
Parameters:
- bytes the binary or text data which is send to the server
- length the length in bytes of the data
- opCode desired opcode of a WebSocket message to be sent
function GetBufferedAmount
Section titled “function GetBufferedAmount”inline virtual unsigned GetBufferedAmount()Called when the JS web socket want to get buffered amount of data.
Return: the number of bytes of data that have been queued using calls to IClientSideSocket::Send()
function GetProtocol
Section titled “function GetProtocol”inline virtual const char * GetProtocol()Called when the JS web socket want to name of the sub-protocol the server selected.
Return: selected sub-protocol
function Close
Section titled “function Close”inline virtual void Close( unsigned code, const char * reason, unsigned length)Called when the JS web socket want to close the connection with server.
Parameters:
- code indicate the status code explaining why the connection is being closed
- reason a human-readable string explaining why the connection is closing
- length the length in bytes of the reason
function Terminate
Section titled “function Terminate”inline virtual void Terminate( unsigned code, const char * reason, unsigned length)Called when the JS web socket will no longer will call IClientSideSocket and now is safe to destroy this object. The method must close the connection to the server and also it’s no longer safe to use a.
Parameters:
- code indicate the status code explaining why the connection is being closed
- reason a human-readable string explaining why the connection is closing
- length the length in bytes of the reason
© 2026 Coherent Labs. All rights reserved.