mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
Detection of closed websocket connection
When the websocket connection is closed, a non-empty frame (n>0) may be received with FRAME_OP_CLOSE flag bit set. Tested with chrome 54.0.2840.99 ; after establishing the websocket connection, if the connection is not closed by javascript and the tab is closed, a frame of length n=2 is received with FRAME_OP_CLOSE flag set.
This commit is contained in:
parent
ba4a5af389
commit
f9e6b51a72
@ -119,7 +119,7 @@ public:
|
||||
app.logger().information(Poco::format("Frame received (length=%d, flags=0x%x).", n, unsigned(flags)));
|
||||
ws.sendFrame(buffer, n, flags);
|
||||
}
|
||||
while (n > 0 || (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);
|
||||
while (n > 0 && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);
|
||||
app.logger().information("WebSocket connection closed.");
|
||||
}
|
||||
catch (WebSocketException& exc)
|
||||
|
Loading…
Reference in New Issue
Block a user