Skip to content

Commit

Permalink
fix Issue #25 - timeout WebSocket connection on inactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Feb 22, 2014
1 parent bd818e2 commit 408de3d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void runSession(WebSocket sock)

Appender!(char[]) buf;

while (sock.waitForData())
while (sock.waitForData(5.minutes))
{
string msg;
try
Expand Down Expand Up @@ -95,4 +95,7 @@ void runSession(WebSocket sock)
return sock.sendError("Internal error reading process output.");
}
}

if (sock.connected)
return sock.sendError("Connection closed due to inactivity (5 minutes).");
}

0 comments on commit 408de3d

Please sign in to comment.