Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Error working with private and presence channels #7

Open
peterson-umoke opened this issue May 2, 2020 · 13 comments
Open

Error working with private and presence channels #7

peterson-umoke opened this issue May 2, 2020 · 13 comments

Comments

@peterson-umoke
Copy link

Hello heywhy,
please i have issues connecting to my laravel broadcast with the private and presence channels, only the public channels seem to be working fine, i have investigated and found out that headers need to be attached to PusherOptions, i have added the headers but still keep having issues, here is the codebase.

String _authUrl = "http://$url:$port/broadcasting/auth";
      Map headers = await _headers;

      log("the authrlksdlfsdf ${headers['Authorization']}");

      PusherAuth _pusherAuth = PusherAuth(
        _authUrl,
        headers: headers,
      );
      log("${_pusherAuth.toJson()}");

      PusherOptions _pusherOptions = PusherOptions(
        host: url,
        port: port,
        encrypted: false,
        auth: _pusherAuth,
      );

      _pusher = FlutterPusher(
        appKey,
        _pusherOptions,
        lazyConnect: true,
        enableLogging: true,
        onConnectionStateChange: (ConnectionStateChange events) =>
            log("${events.currentState}"),
        onError: (ConnectionError e) =>
            log("Error occurred logging you in with auth tokens ${e.toJson()}"),
      );

      _pusher.connect();
      _echo = new Echo({
        "broadcaster": "pusher",
        "client": _pusher,
      });

      try {
        _echo
            .private('heartbeat')
            .listen('Heartbeat', (e) => log("Private channel result: $e"));
      } on PlatformException catch (e) {
        print("Error occurred trying to login with your key, $e");
      }
@heywhy
Copy link
Owner

heywhy commented May 2, 2020

Please confirm that the installed version is 0.2.1. The authorizer is being set on the pusher client instance.

@peterson-umoke
Copy link
Author

yes i am.

@peterson-umoke
Copy link
Author

Here is a screenshot of the error i am seeing
image

@heywhy
Copy link
Owner

heywhy commented May 2, 2020

Is the echo server on your local machine?

@heywhy
Copy link
Owner

heywhy commented May 2, 2020

I'm not facing this issue. The problem you facing seem to be that the emulator can't communicate with the server u specified.

Screen Shot 2020-05-03 at 12 54 29 AM

@peterson-umoke
Copy link
Author

okay i will try another emulator,

@peterson-umoke
Copy link
Author

Is the echo server on your local machine?

no its not on my local machine

@heywhy
Copy link
Owner

heywhy commented May 3, 2020

Can you access the auth route from an HTTP client like Postman?

@peterson-umoke
Copy link
Author

are you suggesting i try sending a get request to the server to see if it responds?

@heywhy
Copy link
Owner

heywhy commented Jul 17, 2020

I want to believe that you've been able to resolve this issue

@peterson-umoke
Copy link
Author

peterson-umoke commented Jul 17, 2020 via email

@peterson-umoke
Copy link
Author

peterson-umoke commented Jul 17, 2020 via email

@heywhy
Copy link
Owner

heywhy commented Jul 17, 2020

I'm very sorry about that, can you create a snippet and send to my personal mail. I have a hunch that the authentication URL is the problem because the FileNotFoundException tells that the endpoint is not found which is as it is in your case.

You can reference this issue: #12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants