connectSocket method
- @visibleForTesting
- WebSocketChannel socketChannel
Implementation
@visibleForTesting
void connectSocket(WebSocketChannel socketChannel) {
final socket = WebSocket._(socketChannel, _broadcast);
_websockets.add(socket);
connect(socket);
socket.stream.listen((message) {
onMessage(message, socket);
}, onDone: () {
_websockets.remove(socket);
disconnect(socket);
});
}