MCPcopy Create free account
hub / github.com/Snapchat/Valdi / start

Method start

valdi/src/valdi/hermes/WebSocketServer/WebSocketServerImpl.cpp:72–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72Result<Void> WebSocketServerImpl::start() {
73 std::unique_lock<Mutex> guard(_mutex);
74 websocketpp::lib::error_code ec;
75 if (_asioThread != nullptr) {
76 return Void();
77 }
78 _server.init_asio(ec);
79 if (ec) {
80 return Error(ec.message().c_str());
81 }
82
83 _server.listen(_port, ec);
84 if (ec) {
85 return Error(ec.message().c_str());
86 }
87
88 _server.start_accept(ec);
89 if (ec) {
90 return Error(ec.message().c_str());
91 }
92
93 _asioThread = Thread::create(STRING_LITERAL("Valdi Websocket Server"), ThreadQoSClassNormal, [this]() {
94 runIOService();
95 }).moveValue();
96 return Void();
97}
98
99void WebSocketServerImpl::stop() {
100 websocketpp::lib::error_code ec;

Callers

nothing calls this directly

Calls 4

messageMethod · 0.80
VoidClass · 0.50
ErrorInterface · 0.50
createFunction · 0.50

Tested by

no test coverage detected