Skip to content
Snippets Groups Projects
Commit 0dfe52d9 authored by Clément Pit-Claudel's avatar Clément Pit-Claudel
Browse files

server: Document `diconnect`'s idempotency requirement

Suggested-by: @azuz
parent 13687b54
Branches
Tags
1 merge request!40Properly handle sudden websocket disconnections
...@@ -103,6 +103,7 @@ private[web] abstract class ServerApp: ...@@ -103,6 +103,7 @@ private[web] abstract class ServerApp:
() ()
} }
/** Records a disconnection. May be called multiple times (should be idempotent). **/
def disconnect(userId: UserId, channel: WebSocketChannel): Unit = instanceLock.synchronized: def disconnect(userId: UserId, channel: WebSocketChannel): Unit = instanceLock.synchronized:
if channels(userId).remove(channel) then if channels(userId).remove(channel) then
println(f"[${appInfo.id}/$instanceId/$userId] client disconnected") println(f"[${appInfo.id}/$instanceId/$userId] client disconnected")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment