open method

FakeTransport open()

Opens a connection. Pass this straight to a hub as its transport factory.

Each call supersedes the last, and clears the subscriptions the previous socket had — as a real server would, since a new socket knows nothing about an old one's state.

Implementation

FakeTransport open() {
  _timer?.cancel();
  _subscribed.clear();
  final FakeTransport transport = FakeTransport(onSend: _onFrame);
  _transport = transport;
  _timer = Timer.periodic(tick, (_) => pump());
  return transport;
}