connect method

Future<PushResponse> connect()

Establishes connection to the server.

Usually all event listeners should be already attached when this method is invoked.

Returns a Future which resolves when the first connection attempt is carried out. However, note that connection may not always succeed on the first attempt — for state changes, do rely on the InboxReadyEvent and InboxUpdatedEvent events instead.

Implementation

Future<PushResponse> connect() {
  if (_connectHasBeenCalled != false) {
    throw StateError(
        "This Inbox instance's .connect() method has already been called once.");
  }

  _connectHasBeenCalled = true;

  return _setUpChannel();
}