9 #ifndef CPPSERVER_HTTP_WS_SERVER_H
10 #define CPPSERVER_HTTP_WS_SERVER_H
31 using HTTPServer::HTTPServer;
43 virtual bool CloseAll(
int status,
const void* buffer,
size_t size);
44 virtual bool CloseAll(
int status, std::string_view text);
47 bool Multicast(
const void* buffer,
size_t size)
override;
62 std::shared_ptr<Asio::TCPSession>
CreateSession(
const std::shared_ptr<Asio::TCPServer>& server)
override {
return std::make_shared<WSSession>(std::dynamic_pointer_cast<WSServer>(server)); }
virtual bool CloseAll(int status)
size_t MulticastBinary(std::string_view text)
size_t MulticastText(const void *buffer, size_t size)
virtual ~WSServer()=default
size_t MulticastBinary(const void *buffer, size_t size)
size_t MulticastPing(const void *buffer, size_t size)
WSServer & operator=(const WSServer &)=delete
std::shared_ptr< Asio::TCPSession > CreateSession(const std::shared_ptr< Asio::TCPServer > &server) override
size_t MulticastPing(std::string_view text)
size_t MulticastText(std::string_view text)
WSServer(WSServer &&)=delete
WSServer & operator=(WSServer &&)=delete
WSServer(const WSServer &)=delete
bool Multicast(const void *buffer, size_t size) override
Multicast data to all connected WebSocket sessions.
void PrepareSendFrame(uint8_t opcode, bool mask, const void *buffer, size_t size, int status=0)
Prepare WebSocket send frame.
static const uint8_t WS_TEXT
Text frame.
static const uint8_t WS_BINARY
Binary frame.
static const uint8_t WS_PING
Ping frame.
static const uint8_t WS_FIN
Final frame.
std::mutex _ws_send_lock
Send buffer lock.
std::vector< uint8_t > _ws_send_buffer
Send buffer.
C++ Server project definitions.
WebSocket session definition.