connectSocket method

  1. @visibleForTesting
void connectSocket(
  1. 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);
  });
}