WPILibC++ 2023.4.3
|
Dedicated WebSocket server. More...
#include <wpinet/WebSocketServer.h>
Classes | |
struct | ServerOptions |
Server options. More... | |
Public Member Functions | |
WebSocketServer (uv::Stream &stream, std::span< const std::string_view > protocols, ServerOptions options, const private_init &) | |
Private constructor. More... | |
Static Public Member Functions | |
static std::shared_ptr< WebSocketServer > | Create (uv::Stream &stream, std::span< const std::string_view > protocols={}, const ServerOptions &options={}) |
Starts a dedicated WebSocket server on the provided connection. More... | |
static std::shared_ptr< WebSocketServer > | Create (uv::Stream &stream, std::initializer_list< std::string_view > protocols, const ServerOptions &options={}) |
Starts a dedicated WebSocket server on the provided connection. More... | |
Public Attributes | |
sig::Signal< std::string_view, WebSocket & > | connected |
Connected event. More... | |
Dedicated WebSocket server.
wpi::WebSocketServer::WebSocketServer | ( | uv::Stream & | stream, |
std::span< const std::string_view > | protocols, | ||
ServerOptions | options, | ||
const private_init & | |||
) |
Private constructor.
|
inlinestatic |
Starts a dedicated WebSocket server on the provided connection.
The connection should be an accepted client stream. This also sets the stream user data to the socket server. A connected event is emitted when the connection is opened.
stream | Connection stream |
protocols | Acceptable subprotocols |
options | Handshake options |
|
static |
Starts a dedicated WebSocket server on the provided connection.
The connection should be an accepted client stream. This also sets the stream user data to the socket server. A connected event is emitted when the connection is opened.
stream | Connection stream |
protocols | Acceptable subprotocols |
options | Handshake options |
sig::Signal<std::string_view, WebSocket&> wpi::WebSocketServer::connected |
Connected event.
First parameter is the URL, second is the websocket.