Skip to content

Header data not receiving in backend #120

Open
@razaGetScope

Description

@razaGetScope

Hello guys,

We are using a presence channel and I need to some data via headers, but somehow its not reaching backend and not logging in backend logs as well, I tried sending both params and headers but none of them showed up in backend logs and due to this I am getting unauthenticated error.

This is my init code on app startup

 initPusher() async {
    if (pusher.connectionState != 'CONNECTED') {
      try {
        await pusher.init(
          apiKey: pusherApiKey,
          cluster: clusterKey,
          authParams: {
            'params': {'foo': 'bar'},
            'headers': {
              'x-token': 'xxxx',
              'x-token-user': 'xxx',
            }
          },
          onConnectionStateChange: (currentState, previousState) {
            var abc = currentState;
          },
          onSubscriptionSucceeded: (channelName, data) {
            var abc = data;
          },
          onSubscriptionError: (channelName, data) {
            var abc = data;
          },
          onError: (message, code, error) {
            var abc = message;
          },
          authEndpoint: endPoint,
        );

        await pusher.connect();
      } on Exception catch (e) {
        log('Error: $e');
      }
    }
  }

And below is my code when I try to subscribe to specific presence channel

  subscribePusher(
    String cId,
  ) async {
    var cName = channelName + cId;

    await pusher.subscribe(
        channelName: cName,
        onEvent: (onEvent) {
          var abc = onEvent;
        },
        onSubscriptionError: (message, code, error) {
          var abc = message;
        });
  }

  static pusherEventsHandler(dynamic data) {
    var abc = data;
  }
}

please let me know if I am missing something here

Thanks

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