class

FWebSocket

Module
GameNet
Header
#include "GameNet/WebSocket.h"
Namespace
Mowo

Constructors

SignatureNameDescription
FWebSocket()FWebSocket
~FWebSocket()~FWebSocket
FWebSocket(const FWebSocket&) = deleteFWebSocket

Public functions

ReturnsNameDescription
FWebSocket&operator=
boolConnectBlocking HTTP upgrade to ws:// or wss://.
voidPollNon-blocking pump: drains everything the socket has, reassembles fragmented frames, answers PINGs, queues complete messages.
boolReceivePop one complete message.
boolSendText
boolSendBinary
boolSendPing
voidCloseSends a CLOSE frame when still connected, then tears down.
EWebSocketStateGetState
const std::string&GetError

Function details

FWebSocket

C++
FWebSocket()

~FWebSocket

C++
~FWebSocket()

FWebSocket

C++
FWebSocket(const FWebSocket&) = delete

operator=

C++
FWebSocket& operator=(const FWebSocket&) = delete

Connect

C++
bool Connect(const std::string& url, const std::vector<std::string>& headers = {}, long timeoutSeconds = 15)

Blocking HTTP upgrade to ws:// or wss://. Extra headers are raw "Name: value" lines (e.g. an auth token when the gateway wants it in a header rather than the query string).

Poll

C++
void Poll()

Non-blocking pump: drains everything the socket has, reassembles fragmented frames, answers PINGs, queues complete messages. Call once per tick. State moves to Closed/Failed here, never mid-Receive.

Receive

C++
bool Receive(FWebSocketMessage& out)

Pop one complete message. Returns false when the queue is empty.

SendText

C++
bool SendText(const std::string& payload)

SendBinary

C++
bool SendBinary(const void* data, size_t size)

SendPing

C++
bool SendPing(const std::string& payload = "")

Close

C++
void Close()

Sends a CLOSE frame when still connected, then tears down.

GetState

C++
EWebSocketState GetState() const

GetError

C++
const std::string& GetError() const
Generated from GameNet/WebSocket.h via gamenet.json · Oct 26, 2026Version 1.0.0