accept method

void accept(
  1. WebSocket socket
)

Takes over socket after the upgrade and sends hello.

Implementation

void accept(WebSocket socket) {
  // The nonces of the gateway are those of REST (08 7.3: stateless, current and previous).
  final conn = _Conn(_conns.length + 1, socket, verifier.currentNonce);
  _conns.add(conn);
  socket.listen(
    (data) => _onFrame(conn, data),
    onDone: () => _onDone(conn),
    onError: (Object _) => _onDone(conn),
  );
  _send(conn, 'hello', {
    'heartbeat_interval_ms': timings.heartbeatInterval.inMilliseconds,
    'resume_window_ms': timings.resumeWindow.inMilliseconds,
    'protocol_versions': [1],
    'dpop_nonce': conn.nonce,
    'server_time': world.stamp(),
    'sync_epoch': world.syncEpoch,
  });
}