Skip to content

Commit

Permalink
deploy: e7b7b62
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaybd committed Dec 2, 2023
1 parent fb50cf6 commit af60692
Show file tree
Hide file tree
Showing 46 changed files with 137 additions and 132 deletions.
49 changes: 27 additions & 22 deletions WebSocketServer_8h_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,31 @@
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_typedefRef" href="https://docs.opencv.org/4.2.0/d2/d75/namespacecv.html#ab8f9e3c8d45fa2f89547aa6367185a6f">uint16_t</a> port;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> websocketpp::server&lt;websocketpp::config::asio&gt; server;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keywordtype">bool</span> isRunning;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="comment">// maps path prefix to ProtocolData for each protocol</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a07763.html">std::map&lt;std::string, ProtocolData&gt;</a> protocolMap;</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a02863.html">std::thread</a> serverThread;</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_class" href="classutil_1_1PeriodicScheduler.html">util::PeriodicScheduler&lt;&gt;</a> pingScheduler;</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="comment">// called when connection is received and being validated.</span></div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="comment">// return true to accept, false to reject</span></div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordtype">bool</span> validate(connection_hdl hdl);</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="comment">// called when connection is opened</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordtype">void</span> onOpen(connection_hdl hdl);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="comment">// called when connection is closed</span></div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordtype">void</span> onClose(connection_hdl hdl);</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordtype">void</span> onMessage(connection_hdl hdl, <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a06899.html">message_t</a> message);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="comment">// called when pong message received from WS client</span></div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordtype">void</span> onPong(connection_hdl hdl, <span class="keyword">const</span> <a class="code hl_variableRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a01516.html#gaa5dbcd13c2fb305025ac6784482d05a5">std::string</a>&amp; payload);</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordtype">void</span> serverTask();</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span>};</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="comment">// protects against race conditions modifying protocolMap</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a07191.html">std::mutex</a> protocolMapMutex;</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="comment">// maps path prefix to ProtocolData for each protocol</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a07763.html">std::map&lt;std::string, ProtocolData&gt;</a> protocolMap;</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a02863.html">std::thread</a> serverThread;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <a class="code hl_class" href="classutil_1_1PeriodicScheduler.html">util::PeriodicScheduler&lt;&gt;</a> pingScheduler;</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="comment">// called when connection is received and being validated.</span></div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="comment">// return true to accept, false to reject</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordtype">bool</span> validate(connection_hdl hdl);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="comment">// called when connection is opened</span></div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordtype">void</span> onOpen(connection_hdl hdl);</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="comment">// called when connection is closed</span></div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keywordtype">void</span> onClose(connection_hdl hdl);</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordtype">void</span> onMessage(connection_hdl hdl, <a class="code hl_classRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a06899.html">message_t</a> message);</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="comment">// called when pong message received from WS client</span></div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <span class="keywordtype">void</span> onPong(connection_hdl hdl, <span class="keyword">const</span> <a class="code hl_variableRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a01516.html#gaa5dbcd13c2fb305025ac6784482d05a5">std::string</a>&amp; payload);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordtype">void</span> serverTask();</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="comment">// Thread-safe access of the protocolMap</span></div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> std::optional&lt;std::reference_wrapper&lt;SingleClientWSServer::ProtocolData&gt;&gt;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> getProtocol(<span class="keyword">const</span> <a class="code hl_variableRef" href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a01516.html#gaa5dbcd13c2fb305025ac6784482d05a5">std::string</a>&amp; protocolPath);</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span>};</div>
</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span>} <span class="comment">// namespace websocket</span></div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span>} <span class="comment">// namespace net</span></div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span>} <span class="comment">// namespace websocket</span></div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span>} <span class="comment">// namespace net</span></div>
<div class="ttc" id="aa00071_html"><div class="ttname"><a href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a00071.html">functional</a></div></div>
<div class="ttc" id="aa00104_html"><div class="ttname"><a href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a00104.html">map</a></div></div>
<div class="ttc" id="aa00107_html"><div class="ttname"><a href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a00107.html">memory</a></div></div>
Expand All @@ -180,9 +185,9 @@
<div class="ttc" id="aa07763_html"><div class="ttname"><a href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a07763.html">std::map</a></div></div>
<div class="ttc" id="aa08015_html"><div class="ttname"><a href="https://gcc.gnu.org/onlinedocs/gcc-9.3.0/libstdc++/api/a08015.html">std::unique_ptr</a></div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html">net::websocket::SingleClientWSServer</a></div><div class="ttdoc">A WebSocket server class that only accepts a single client at a time to each endpoint served by this ...</div><div class="ttdef"><b>Definition</b> WebSocketServer.h:35</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_a1c61e5d20850e351ee97760a0c65e13b"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#a1c61e5d20850e351ee97760a0c65e13b">net::websocket::SingleClientWSServer::sendJSON</a></div><div class="ttdeci">void sendJSON(const std::string &amp;protocolPath, const json &amp;obj)</div><div class="ttdoc">Serialize the JSON as a string and send it to the client connected to the given protocol path,...</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:108</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_a96d029a7fcc48f6339b896ee17c64343"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#a96d029a7fcc48f6339b896ee17c64343">net::websocket::SingleClientWSServer::sendRawString</a></div><div class="ttdeci">void sendRawString(const std::string &amp;protocolPath, const std::string &amp;str)</div><div class="ttdoc">Send a string to the client connected to the given protocol path, if there is one.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:92</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_aa08f6e05407ab181016886ef95b81f6c"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#aa08f6e05407ab181016886ef95b81f6c">net::websocket::SingleClientWSServer::addProtocol</a></div><div class="ttdeci">bool addProtocol(std::unique_ptr&lt; WebSocketProtocol &gt; protocol)</div><div class="ttdoc">Register a protocol with this server.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:82</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_a1c61e5d20850e351ee97760a0c65e13b"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#a1c61e5d20850e351ee97760a0c65e13b">net::websocket::SingleClientWSServer::sendJSON</a></div><div class="ttdeci">void sendJSON(const std::string &amp;protocolPath, const json &amp;obj)</div><div class="ttdoc">Serialize the JSON as a string and send it to the client connected to the given protocol path,...</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:114</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_a96d029a7fcc48f6339b896ee17c64343"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#a96d029a7fcc48f6339b896ee17c64343">net::websocket::SingleClientWSServer::sendRawString</a></div><div class="ttdeci">void sendRawString(const std::string &amp;protocolPath, const std::string &amp;str)</div><div class="ttdoc">Send a string to the client connected to the given protocol path, if there is one.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:97</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_aa08f6e05407ab181016886ef95b81f6c"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#aa08f6e05407ab181016886ef95b81f6c">net::websocket::SingleClientWSServer::addProtocol</a></div><div class="ttdeci">bool addProtocol(std::unique_ptr&lt; WebSocketProtocol &gt; protocol)</div><div class="ttdoc">Register a protocol with this server.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:86</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_ac6eba89635a679c01f7b6891123c1d80"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#ac6eba89635a679c01f7b6891123c1d80">net::websocket::SingleClientWSServer::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">Stop the server.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:59</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_ae5f4b4ef17fb26725e0c6d52909ec9da"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#ae5f4b4ef17fb26725e0c6d52909ec9da">net::websocket::SingleClientWSServer::start</a></div><div class="ttdeci">bool start()</div><div class="ttdoc">Start the server.</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:38</div></div>
<div class="ttc" id="aclassnet_1_1websocket_1_1SingleClientWSServer_html_aea232573631f9818696d1faa66d2204f"><div class="ttname"><a href="classnet_1_1websocket_1_1SingleClientWSServer.html#aea232573631f9818696d1faa66d2204f">net::websocket::SingleClientWSServer::~SingleClientWSServer</a></div><div class="ttdeci">~SingleClientWSServer()</div><div class="ttdoc">Destroy the server after calling stop()</div><div class="ttdef"><b>Definition</b> WebSocketServer.cpp:34</div></div>
Expand Down
Loading

0 comments on commit af60692

Please sign in to comment.