Created
August 11, 2015 02:02
-
-
Save FaisalAbid/e0e1928b8b81bc0bf6d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleMessage(WebSocket webSocket) { | |
webSocket.map((string) => JSON.decode(string)).listen((Map map) async { | |
if (map["type"] == "client") { | |
await connectClient(map["userID"], webSocket); | |
} else { | |
await handleChatMessage(map, webSocket); | |
} | |
}, onError: (error, stack) { | |
Logger.root.severe(error); | |
Logger.root.severe(stack); | |
}, onDone: () { | |
Logger.root.severe("${clients.inverse.remove(webSocket)} disconnected"); | |
webSocket.close(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment