Skip to content

I am getting this error while trying to connect to pusher "Connection not authorized within timeout (4009)" #199

@jatin-web

Description

@jatin-web

String pusherAppKey = 'my_api_key';

  String cluster = 'ap1';
  String? token = await TokenService.getToken();
  if (token == null) {
    showSimpleSnackbar("Error: Token is not present");
    return;
  }
  await pusher.init(
    apiKey: pusherAppKey,
    cluster: cluster,
    logToConsole: true,
    onEvent: (event) {
      debugPrint("Event: $event");
    },
    onConnectionStateChange: (currentState, previousState) {
      print("Connection: $previousState -> $currentState");
    },
    onError: (message, code, e) {
      print("Error: $message ($code)");
    },
    authEndpoint: "https://lifenavi.com/broadcasting/auth",
    authParams: {
      'headers': {
        'Authorization': 'Bearer $token',
        'Content-Type': 'application/json',
      },
    },
  );
  await pusher.connect();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions