Commit e81e4479 authored by Thomas Kolb's avatar Thomas Kolb

Set 1 second timeout for websockets

parent 143d569b
......@@ -72,6 +72,11 @@ int RelayServer::Run()
h.onConnection(
[](uWS::WebSocket<uWS::SERVER> *ws, uWS::HttpRequest req)
{
unsigned int timeout = 1000; // in milliseconds
if(setsockopt(ws->getFd(), IPPROTO_TCP, TCP_USER_TIMEOUT, &timeout, sizeof(unsigned int)) < 0) {
std::cerr << "Cannot set user timeout" << std::endl;
}
ws->setUserData(new WebsocketConnection(ws));
}
);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment