Skip to content
SiteEmail

FCohtmlWebSocketWrapper

Inherits from IClientSideSocket

Name
FCohtmlWebSocketWrapper(cohtml::ISocketListener * InListener, const char * url, const char ** protocols, unsigned protocolsCount)
virtual voidSend(const char * bytes, unsigned length, cohtml::websocket::OpCode code) override
Called when the JS web socket want to send binary or text data to the server.
virtual unsignedGetBufferedAmount() override
Called when the JS web socket want to get buffered amount of data.
virtual const char *GetProtocol() override
Called when the JS web socket want to name of the sub-protocol the server selected.
virtual voidClose(unsigned code, const char * reason, unsigned length) override
Called when the JS web socket want to close the connection with server.
virtual voidTerminate(unsigned code, const char * reason, unsigned length) override
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.
voidHandleUEWebSocketConnected()
voidHandleUEWebSocketConnectionError(const FString & Error)
voidHandleUEWebSocketConnectionClosed(int32 Status, const FString & Reason, bool bWasClean)
voidHandleUEWebSocketTextData(const FString & Message)
voidHandleUEWebSocketBinaryData(const void * Data, SIZE_T Size, bool bIsLastFragment)
FCohtmlWebSocketWrapper(
cohtml::ISocketListener * InListener,
const char * url,
const char ** protocols,
unsigned protocolsCount
)
virtual void Send(
const char * bytes,
unsigned length,
cohtml::websocket::OpCode code
) override

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
inline virtual unsigned GetBufferedAmount() override

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() Messages are not buffered for this implementation, so this is always 0

inline virtual const char * GetProtocol() override

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

Return: selected sub-protocol Not implemented, since the UE4 API does not allow getting the protocol

virtual void Close(
unsigned code,
const char * reason,
unsigned length
) override

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
virtual void Terminate(
unsigned code,
const char * reason,
unsigned length
) override

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
void HandleUEWebSocketConnected()
void HandleUEWebSocketConnectionError(
const FString & Error
)

function HandleUEWebSocketConnectionClosed

Section titled “function HandleUEWebSocketConnectionClosed”
void HandleUEWebSocketConnectionClosed(
int32 Status,
const FString & Reason,
bool bWasClean
)
void HandleUEWebSocketTextData(
const FString & Message
)
void HandleUEWebSocketBinaryData(
const void * Data,
SIZE_T Size,
bool bIsLastFragment
)