No way to know what websocket is being close.
delaneyj opened this issue · comments
Delaney commented
With a normal HttpServer you can transform a request into a websocket like this.
WebSocketTransformer.upgrade(request).then((WebSocket websocket) {
onWebSocketConnected(websocket);
websocket.listen((data){
onWebSocketDataReceived(websocket,data);
},onDone:(){
onWebSocketClosed(websocket);
});
});
Notice that I can still access the websocket during the closing. This allows for handling of temp data (session-ish things) to be cleared once the socket closes. I would really like to use start for its clean semantics and want to know how to get this information properly within start's framework.
Yehor Lvivski commented
Thanks for the idea, added two more streams, like the client-side web sockets have. See example/app.dart
for the reference.