1.26.2.1
Gameface
cohtml::IClientSideSocket Class Reference

The IClientSideSocket represents platform/client specific part of the web sockets. More...

Public Member Functions

 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. More...
 
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. More...
 
virtual unsigned GetBufferedAmount ()
 Called when the JS web socket want to get buffered amount of data. More...
 
virtual const char * GetProtocol ()
 Called when the JS web socket want to name of the sub-protocol the server selected. More...
 
virtual void Close (unsigned code, const char *reason, unsigned length)
 Called when the JS web socket want to close the connection with server. More...
 
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. More...
 

Detailed Description

The IClientSideSocket represents platform/client specific part of the web sockets.

Constructor & Destructor Documentation

◆ IClientSideSocket()

cohtml::IClientSideSocket::IClientSideSocket ( )

◆ ~IClientSideSocket()

virtual cohtml::IClientSideSocket::~IClientSideSocket ( )
virtual

Member Function Documentation

◆ Close()

virtual void cohtml::IClientSideSocket::Close ( unsigned  code,
const char *  reason,
unsigned  length 
)
inlinevirtual

Called when the JS web socket want to close the connection with server.

Parameters
codeindicate the status code explaining why the connection is being closed
reasona human-readable string explaining why the connection is closing
lengththe length in bytes of the reason

◆ GetBufferedAmount()

virtual unsigned cohtml::IClientSideSocket::GetBufferedAmount ( )
inlinevirtual

Called when the JS web socket want to get buffered amount of data.

Returns
the number of bytes of data that have been queued using calls to IClientSideSocket::Send()

◆ GetProtocol()

virtual const char* cohtml::IClientSideSocket::GetProtocol ( )
inlinevirtual

Called when the JS web socket want to name of the sub-protocol the server selected.

Returns
selected sub-protocol

◆ Send() [1/2]

virtual void cohtml::IClientSideSocket::Send ( const char *  bytes,
unsigned  length 
)
inlinevirtual

Called when the JS web socket want to send text data to the server.

Parameters
bytestext data which is send to the server
lengththe length in bytes of the data
Warning
Will be deprecated, implement IClientSideSocket::Send/3 instead.

◆ Send() [2/2]

virtual void cohtml::IClientSideSocket::Send ( const char *  bytes,
unsigned  length,
cohtml::websocket::OpCode  opCode 
)
inlinevirtual

Called when the JS web socket want to send binary or text data to the server.

Parameters
bytesthe binary or text data which is send to the server
lengththe length in bytes of the data
opCodedesired opcode of a WebSocket message to be sent

◆ Terminate()

virtual void cohtml::IClientSideSocket::Terminate ( unsigned  code,
const char *  reason,
unsigned  length 
)
inlinevirtual

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
codeindicate the status code explaining why the connection is being closed
reasona human-readable string explaining why the connection is closing
lengththe length in bytes of the reason