22 return HTTPServer::DisconnectAll();
33 return HTTPServer::DisconnectAll();
44 assert((buffer !=
nullptr) &&
"Pointer to the buffer should not be null!");
45 if (buffer ==
nullptr)
53 auto ws_session = std::dynamic_pointer_cast<WSSession>(session.second);
56 std::scoped_lock ws_locker(ws_session->_ws_send_lock);
58 if (ws_session->_ws_handshaked)
59 ws_session->SendAsync(buffer, size);
std::map< CppCommon::UUID, std::shared_ptr< TCPSession > > _sessions
std::shared_mutex _sessions_lock
bool IsStarted() const noexcept
Is the server started?
bool Multicast(const void *buffer, size_t size) override
Multicast data to all connected WebSocket sessions.
static const uint8_t WS_CLOSE
Close frame.
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_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 server definition.