Skip to content

Commit

Permalink
run server until websocket connection is not closed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahad-10 committed May 4, 2024
1 parent b9bdd55 commit 92759ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class Server {
BaseSession baseSession = await a.accept(webSocket);
router.attachClient(baseSession);

_handleWebSocket(baseSession);
_handleWebSocket(baseSession, webSocket);
}
}

void _handleWebSocket(BaseSession baseSession) {
void _handleWebSocket(BaseSession baseSession, WebSocket webSocket) {
Future.microtask(() async {
while (true) {
while (webSocket.closeCode == null) {
var message = await baseSession.receiveMessage();
await router.receiveMessage(baseSession, message);
}
Expand Down

0 comments on commit 92759ba

Please sign in to comment.