template<typename
TSocket>
class NNet::TWebSocket< TSocket >
Client-side WebSocket framing layer over an already-connected socket.
Wraps TSocket with RFC 6455 framing. The underlying socket must be TCP-connected before calling Connect(). TWebSocket holds a reference to the socket — the socket must outlive the TWebSocket instance.
Only text frames are exposed. Outgoing frames are client-masked as required by RFC 6455. Server-side upgrade is not included.
- Template Parameters
-
| TSocket | Connected socket type providing ReadSome / WriteSome. |
template<typename TPoller>
typename TPoller::TSocket sock(poller, addr.
Domain());
co_await sock.Connect(addr);
co_await ws.Connect("example.com", "/chat");
co_await ws.SendText("hello");
std::string_view msg = co_await ws.ReceiveText();
}
A class representing an IPv4 or IPv6 address (with port).
Definition address.hpp:38
int Domain() const
Gets the domain (address family) of the stored address.
Definition address.cpp:45
Client-side WebSocket framing layer over an already-connected socket.
Definition ws.hpp:79
Owned coroutine handle that carries a result of type T.
Definition corochain.hpp:185