heywhy / flutter-pusher-client

A pusher.com client written with dart for flutter
MIT License
9 stars 30 forks source link

Error working with private and presence channels #7

Open peterson-umoke opened 4 years ago

peterson-umoke commented 4 years ago

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 commented 4 years ago

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

peterson-umoke commented 4 years ago

yes i am.

peterson-umoke commented 4 years ago

Here is a screenshot of the error i am seeing image

heywhy commented 4 years ago

Is the echo server on your local machine?

heywhy commented 4 years ago

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 commented 4 years ago

okay i will try another emulator,

peterson-umoke commented 4 years ago

Is the echo server on your local machine?

no its not on my local machine

heywhy commented 4 years ago

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

peterson-umoke commented 4 years ago

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

heywhy commented 4 years ago

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

peterson-umoke commented 4 years ago

Not at all. I have just given up. As the issue still persists.

Thanks. Peterson N. Umoke.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: atanda rasheedmailto:notifications@github.com Sent: Friday, 17 July 2020 12:54 PM To: heywhy/flutter-pusher-clientmailto:flutter-pusher-client@noreply.github.com Cc: Peterson Umokemailto:umoke10@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [heywhy/flutter-pusher-client] Error working with private and presence channels (#7)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/heywhy/flutter-pusher-client/issues/7#issuecomment-660067029, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC2LKRXZNXCAPB3RQWVWWF3R4A3YTANCNFSM4MX3VTRQ.

peterson-umoke commented 4 years ago

I have decided to rewrite the app in pure java.

Thanks. Peterson N. Umoke.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Peterson .N. Umokemailto:umoke10@hotmail.com Sent: Friday, 17 July 2020 12:55 PM To: heywhy/flutter-pusher-clientmailto:reply@reply.github.com; heywhy/flutter-pusher-clientmailto:flutter-pusher-client@noreply.github.com Cc: Authormailto:author@noreply.github.com Subject: RE: [heywhy/flutter-pusher-client] Error working with private and presence channels (#7)

Not at all. I have just given up. As the issue still persists.

Thanks. Peterson N. Umoke.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: atanda rasheedmailto:notifications@github.com Sent: Friday, 17 July 2020 12:54 PM To: heywhy/flutter-pusher-clientmailto:flutter-pusher-client@noreply.github.com Cc: Peterson Umokemailto:umoke10@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [heywhy/flutter-pusher-client] Error working with private and presence channels (#7)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/heywhy/flutter-pusher-client/issues/7#issuecomment-660067029, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC2LKRXZNXCAPB3RQWVWWF3R4A3YTANCNFSM4MX3VTRQ.

heywhy commented 4 years ago

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