7#include <initializer_list>
17#include "wpi/util/SmallVector.hpp"
26template <
typename Derived>
29 public std::enable_shared_from_this<Derived> {
38 std::span<const std::string_view> protocols)
41 m_protocols{protocols.begin(), protocols.end()} {
43 m_helper.upgrade.connect([
this] {
45 wpi::util::SmallVector<std::string_view, 2> protocols{m_protocols.begin(),
47 std::string_view protocol = m_helper.MatchProtocol(protocols).second;
60 auto self = this->shared_from_this();
63 auto ws = m_helper.Accept(
m_stream, protocol);
83 std::shared_ptr<uv::Stream> stream,
84 std::initializer_list<std::string_view> protocols)
86 {protocols.begin(), protocols.end()}) {}
120 wpi::util::SmallVector<std::string, 2> m_protocols;
uv::Stream & m_stream
The underlying stream for the connection.
Definition HttpServerConnection.hpp:140
wpi::util::sig::ScopedConnection m_dataConn
The header reader connection.
Definition HttpServerConnection.hpp:143
HttpParser m_request
The HTTP request.
Definition HttpServerConnection.hpp:131
HttpServerConnection(std::shared_ptr< uv::Stream > stream)
wpi::util::sig::Connection m_messageCompleteConn
The message complete connection.
Definition HttpServerConnection.hpp:149
WebSocket * m_websocket
WebSocket connection; not valid until ProcessWsUpgrade is called.
Definition HttpWebSocketServerConnection.hpp:116
HttpWebSocketServerConnection(std::shared_ptr< uv::Stream > stream, std::initializer_list< std::string_view > protocols)
Constructor.
Definition HttpWebSocketServerConnection.hpp:82
virtual void ProcessWsUpgrade()=0
Process an incoming WebSocket upgrade.
virtual bool IsValidWsUpgrade(std::string_view protocol)
Check that an incoming WebSocket upgrade is okay.
Definition HttpWebSocketServerConnection.hpp:98
HttpWebSocketServerConnection(std::shared_ptr< uv::Stream > stream, std::span< const std::string_view > protocols)
Constructor.
Definition HttpWebSocketServerConnection.hpp:37
RFC 6455 compliant WebSocket client and server implementation.
Definition WebSocket.hpp:32
WebSocket HTTP server helper.
Definition WebSocketServer.hpp:31
Definition raw_socket_ostream.hpp:9