WPILibC++  2020.3.2-60-g3011ebe
wpi::WebSocketServer Class Reference

Dedicated WebSocket server. More...

#include <WebSocketServer.h>

Inheritance diagram for wpi::WebSocketServer:

Classes

struct  ServerOptions
 Server options. More...
 

Public Member Functions

 WebSocketServer (uv::Stream &stream, ArrayRef< StringRef > protocols, const ServerOptions &options, const private_init &)
 Private constructor.
 

Static Public Member Functions

static std::shared_ptr< WebSocketServerCreate (uv::Stream &stream, ArrayRef< StringRef > protocols=ArrayRef< StringRef >{}, const ServerOptions &options=ServerOptions{})
 Starts a dedicated WebSocket server on the provided connection. More...
 
static std::shared_ptr< WebSocketServerCreate (uv::Stream &stream, std::initializer_list< StringRef > protocols, const ServerOptions &options=ServerOptions{})
 Starts a dedicated WebSocket server on the provided connection. More...
 

Public Attributes

sig::Signal< StringRef, WebSocket & > connected
 Connected event. More...
 

Detailed Description

Dedicated WebSocket server.

Member Function Documentation

◆ Create() [1/2]

static std::shared_ptr<WebSocketServer> wpi::WebSocketServer::Create ( uv::Stream stream,
ArrayRef< StringRef protocols = ArrayRefStringRef >{},
const ServerOptions options = ServerOptions{} 
)
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.

Parameters
streamConnection stream
protocolsAcceptable subprotocols
optionsHandshake options

◆ Create() [2/2]

static std::shared_ptr<WebSocketServer> wpi::WebSocketServer::Create ( uv::Stream stream,
std::initializer_list< StringRef protocols,
const ServerOptions options = ServerOptions{} 
)
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.

Parameters
streamConnection stream
protocolsAcceptable subprotocols
optionsHandshake options

Member Data Documentation

◆ connected

sig::Signal<StringRef, WebSocket&> wpi::WebSocketServer::connected

Connected event.

First parameter is the URL, second is the websocket.


The documentation for this class was generated from the following file: