authenticate method

Future<void> authenticate(
  1. String token
)

Authenticates the current connection with a JWT token.

Implementation

Future<void> authenticate(String token) {
  final id = _generateId();
  final completer = Completer();
  _ws.ready.then((_) {
    _ws.once(id, (res) {
      _auth(res, completer);
      _send(id, 'authenticate', [token]);
    });
  });
  return completer.future;
}