chinloyal / pusher_client

A Pusher Channels Client for Fluttter (Fully supports Android and iOS)
https://pusher.com/channels
MIT License
43 stars 182 forks source link

ABANDONNED PACKAGE? #39

Open nicolasvahidzein opened 3 years ago

nicolasvahidzein commented 3 years ago

Hello everyone,

this package seems abandonned to me. Am i correct in assuming this?

Chinloyal is not reachable and has not closed a ticket since august.

fabiancrx commented 3 years ago

Have found any alternative @nicolasvahidzein ?

nicolasvahidzein commented 3 years ago

No brother @fabiancrx im stuck. This was the recommended package by the Echo team.

fabiancrx commented 3 years ago

@nicolasvahidzein I was taking a look and the pusher Android package just uses the java one, ergo, no platform specific features are used. Assuming that the iOS version neither uses platform specific features I'm thinking about just rolling up a new package using solely Dart. I don't see any WIP from pusher to create a flutter package and one has it deadlines.

nicolasvahidzein commented 3 years ago

If you can do your own package that would be awesome. Id be the First to try it.

nicolasvahidzein commented 3 years ago

@fabiancrx you can write to me if you need help. I migrated to this plugin

https://github.com/olubunmitosin/laravel_flutter_pusher

and it was a BREEZE! Stop using this one.

nicolasvahidzein commented 3 years ago

This should stay open actually.

ragingallan commented 3 years ago

@fabiancrx you can write to me if you need help. I migrated to this plugin

https://github.com/olubunmitosin/laravel_flutter_pusher

and it was a BREEZE! Stop using this one.

does this work with current flutter update for ios and android? testing this tonight :)

nicolasvahidzein commented 3 years ago

Works for me. Not tested on ios yet. Let me know if you have an issue. My skype: nzein9

ragingallan commented 3 years ago

Works for me. Not tested on ios yet. Let me know if you have an issue. My skype: nzein9

sorry can't see you in skype, however here's what I'm getting after implementation

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
#0      EventChannel.binaryMessenger
package:flutter/…/services/platform_channel.dart:473
#1      EventChannel.receiveBroadcastStream.<anonymous closure>
package:flutter/…/services/platform_channel.dart:493
#2      EventChannel.receiveBroadcastStream.<anonymous closure>
package:flutter/…/services/platform_channel.dart:492
#3      _runGuarded (dart:async/stream_controller.dart:773:24)
#4      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:207:7)
#5      _ControllerStream._createSubscription (dart:async/stream_controller.dart:786:19)
#6      _StreamImpl.listen (dart:async/stream_impl.dart:473:9)
#7      LaravelFlutterPusher._init
package:laravel_flutter_pusher/laravel_flutter_pusher.dart:133
#8      new LaravelFlutterPusher
package:laravel_flutter_pusher/laravel_flutter_pusher.dart:89
#9      main
package:ypf/main.dart:18
#10     main
.dart_tool/flutter_build/generated_main.dart:55
#11     _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:127:38)
#12     _rootRun (dart:async/zone.dart:1428:13)
#13     _CustomZone.run (dart:async/zone.dart:1328:19)
#14     _runZoned (dart:async/zone.dart:1863:10)
#15     runZonedGuarded (dart:async/zone.dart:1851:12)
#16     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:125:5)
#17     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
nicolasvahidzein commented 3 years ago

My apologies nzein19 not 9

try again

paste the full code for your implementation

nicolasvahidzein commented 3 years ago

Here is the full code sample and how you should get it to work:

//flutter packages
import 'package:laravel_echo/laravel_echo.dart';
//import 'package:flutter_pusher_client/flutter_pusher.dart';
//import 'package:pusher_client/pusher_client.dart';
import 'package:laravel_flutter_pusher/laravel_flutter_pusher.dart';

            PusherOptions options = PusherOptions(
                host: websocketsDomain,
                port: websocketsPort,
                cluster: websocketsCluster,
                encrypted: websocketsEncrypted,
                auth: PusherAuth(
                    websocketsAuthEndpointDomain + websocketsAuthEndpointRelativeUrl,
                    headers: {
                        'Authorization':  'Bearer ' + accessToken,
                        'Content-Type': 'application/json',
                        'Accept': 'application/json'
                    },
                ),
        );

            LaravelFlutterPusher pusher = LaravelFlutterPusher(
                websocketsAppId,
                options,
                enableLogging: true,
            );

            _echo = Echo(
                broadcaster: EchoBroadcasterType.Pusher,
                client: pusher,
            );

            pusher.connect(onConnectionStateChange: _onConnectionStateChange).onError((error, stackTrace) {
                print('error: $error');
            });

            //connect to the private channel
            //you can piggy back channel listeners if you are adding more
            _echo!.private('user.${myUserId!}').listen('UserStatusChange', (event) {

                print(event);

            });

    void _onConnectionStateChange(ConnectionStateChange event) {

        print('event:');
        print(event);
        print(event.currentState);

        if (event.currentState == 'CONNECTED') {

            _appStore!.setEcho(_echo);

            _appStore!.setWebsocketConnection(true);

            _appStore!.incrementWebsocketConnectionAttempt();

        } else if (event.currentState == 'DISCONNECTED') {

            _appStore!.setWebsocketConnection(false);

        }

  }

    void disconnect() {

        //disconnect from the server
        _echo!.disconnect();

    }
fabiancrx commented 3 years ago

Hi @nicolasvahidzein I managed to get a fork of this plugin working for me, and just now uploaded the changes here.

It has all un-merged PR's and other goodies. Changes on the fork as of now are:

  pusher_client:
    git:
      url: https://github.com/fabiancrx/pusher_client
ragingallan commented 3 years ago

Here is the full code sample and how you should get it to work:

//flutter packages
import 'package:laravel_echo/laravel_echo.dart';
//import 'package:flutter_pusher_client/flutter_pusher.dart';
//import 'package:pusher_client/pusher_client.dart';
import 'package:laravel_flutter_pusher/laravel_flutter_pusher.dart';

          PusherOptions options = PusherOptions(
              host: websocketsDomain,
              port: websocketsPort,
              cluster: websocketsCluster,
              encrypted: websocketsEncrypted,
              auth: PusherAuth(
                  websocketsAuthEndpointDomain + websocketsAuthEndpointRelativeUrl,
                  headers: {
                      'Authorization':  'Bearer ' + accessToken,
                      'Content-Type': 'application/json',
                      'Accept': 'application/json'
                  },
              ),
      );

          LaravelFlutterPusher pusher = LaravelFlutterPusher(
              websocketsAppId,
              options,
              enableLogging: true,
          );

          _echo = Echo(
              broadcaster: EchoBroadcasterType.Pusher,
              client: pusher,
          );

          pusher.connect(onConnectionStateChange: _onConnectionStateChange).onError((error, stackTrace) {
              print('error: $error');
          });

          //connect to the private channel
          //you can piggy back channel listeners if you are adding more
          _echo!.private('user.${myUserId!}').listen('UserStatusChange', (event) {

              print(event);

          });

  void _onConnectionStateChange(ConnectionStateChange event) {

      print('event:');
      print(event);
      print(event.currentState);

      if (event.currentState == 'CONNECTED') {

          _appStore!.setEcho(_echo);

          _appStore!.setWebsocketConnection(true);

          _appStore!.incrementWebsocketConnectionAttempt();

      } else if (event.currentState == 'DISCONNECTED') {

          _appStore!.setWebsocketConnection(false);

      }

  }

  void disconnect() {

      //disconnect from the server
      _echo!.disconnect();

  }

This solution works mate., THANKS!

I'm using ios 15.0.2

yacinegithub commented 2 years ago

Here is the full code sample and how you should get it to work:

//flutter packages
import 'package:laravel_echo/laravel_echo.dart';
//import 'package:flutter_pusher_client/flutter_pusher.dart';
//import 'package:pusher_client/pusher_client.dart';
import 'package:laravel_flutter_pusher/laravel_flutter_pusher.dart';

          PusherOptions options = PusherOptions(
              host: websocketsDomain,
              port: websocketsPort,
              cluster: websocketsCluster,
              encrypted: websocketsEncrypted,
              auth: PusherAuth(
                  websocketsAuthEndpointDomain + websocketsAuthEndpointRelativeUrl,
                  headers: {
                      'Authorization':  'Bearer ' + accessToken,
                      'Content-Type': 'application/json',
                      'Accept': 'application/json'
                  },
              ),
      );

          LaravelFlutterPusher pusher = LaravelFlutterPusher(
              websocketsAppId,
              options,
              enableLogging: true,
          );

          _echo = Echo(
              broadcaster: EchoBroadcasterType.Pusher,
              client: pusher,
          );

          pusher.connect(onConnectionStateChange: _onConnectionStateChange).onError((error, stackTrace) {
              print('error: $error');
          });

          //connect to the private channel
          //you can piggy back channel listeners if you are adding more
          _echo!.private('user.${myUserId!}').listen('UserStatusChange', (event) {

              print(event);

          });

  void _onConnectionStateChange(ConnectionStateChange event) {

      print('event:');
      print(event);
      print(event.currentState);

      if (event.currentState == 'CONNECTED') {

          _appStore!.setEcho(_echo);

          _appStore!.setWebsocketConnection(true);

          _appStore!.incrementWebsocketConnectionAttempt();

      } else if (event.currentState == 'DISCONNECTED') {

          _appStore!.setWebsocketConnection(false);

      }

  }

  void disconnect() {

      //disconnect from the server
      _echo!.disconnect();

  }

didn't work for me did you still using the same code or something else?

fabiancrx commented 2 years ago

For everyone subscribed to this thread an official package is under development by pusher here . Haven't checked its API and capabilities yet, but it should be the way to go for integrating pusher in a flutter app.

If you successfully migrate from this plugin to the official one, would you be kind enough to comment (I'll add my notes as soon as I do), so everyone subscribed can weigh in the decision of migrating .

yacinegithub commented 2 years ago

For everyone subscribed to this thread an official package is under development by pusher here . Haven't checked its API and capabilities yet, but it should be the way to go for integrating pusher in a flutter app.

If you successfully migrate from this plugin to the official one, would you be kind enough to comment (I'll add my notes as soon as I do), so everyone subscribed can weigh in the decision of migrating .

Does it compatible/work with the laravel websockets pusher replacement?

fabiancrx commented 2 years ago

Sorry @yacinegithub but I don't use laravel 🤷, but it should.

ragingallan commented 2 years ago

For everyone subscribed to this thread an official package is under development by pusher here . Haven't checked its API and capabilities yet, but it should be the way to go for integrating pusher in a flutter app.

If you successfully migrate from this plugin to the official one, would you be kind enough to comment (I'll add my notes as soon as I do), so everyone subscribed can weigh in the decision of migrating .

Does it compatible/work with the laravel websockets pusher replacement?

I'm using this one for laravel. yes, it's working

yacinegithub commented 2 years ago

For everyone subscribed to this thread an official package is under development by pusher here . Haven't checked its API and capabilities yet, but it should be the way to go for integrating pusher in a flutter app. If you successfully migrate from this plugin to the official one, would you be kind enough to comment (I'll add my notes as soon as I do), so everyone subscribed can weigh in the decision of migrating .

Does it compatible/work with the laravel websockets pusher replacement?

I'm using this one for laravel. yes, it's working

thank you, do you mean you use 'laravel_flutter_pusher ' or 'pusher_channels_flutter' package if you meant the second so do you use laravel websockets pusher replacement method, if so would you give us a piece of your code with flutter and laravel needed changes and wich laravel package you use for your api sanctum/passport/jwt

yacinegithub commented 2 years ago

Here is the full code sample and how you should get it to work:

//flutter packages
import 'package:laravel_echo/laravel_echo.dart';
//import 'package:flutter_pusher_client/flutter_pusher.dart';
//import 'package:pusher_client/pusher_client.dart';
import 'package:laravel_flutter_pusher/laravel_flutter_pusher.dart';

            PusherOptions options = PusherOptions(
                host: websocketsDomain,
                port: websocketsPort,
                cluster: websocketsCluster,
                encrypted: websocketsEncrypted,
                auth: PusherAuth(
                    websocketsAuthEndpointDomain + websocketsAuthEndpointRelativeUrl,
                    headers: {
                        'Authorization':  'Bearer ' + accessToken,
                        'Content-Type': 'application/json',
                        'Accept': 'application/json'
                    },
                ),
        );

            LaravelFlutterPusher pusher = LaravelFlutterPusher(
                websocketsAppId,
                options,
                enableLogging: true,
            );

            _echo = Echo(
                broadcaster: EchoBroadcasterType.Pusher,
                client: pusher,
            );

            pusher.connect(onConnectionStateChange: _onConnectionStateChange).onError((error, stackTrace) {
                print('error: $error');
            });

            //connect to the private channel
            //you can piggy back channel listeners if you are adding more
            _echo!.private('user.${myUserId!}').listen('UserStatusChange', (event) {

                print(event);

            });

    void _onConnectionStateChange(ConnectionStateChange event) {

        print('event:');
        print(event);
        print(event.currentState);

        if (event.currentState == 'CONNECTED') {

            _appStore!.setEcho(_echo);

            _appStore!.setWebsocketConnection(true);

            _appStore!.incrementWebsocketConnectionAttempt();

        } else if (event.currentState == 'DISCONNECTED') {

            _appStore!.setWebsocketConnection(false);

        }

  }

    void disconnect() {

        //disconnect from the server
        _echo!.disconnect();

    }

This solution works mate., THANKS!

I'm using ios 15.0.2

for this code i cant get it to work would you give us how you wrote your variables like websocketsDomain, websocketsPort, websocketsCluster and so on i think i made a msitake writing their value thanks

OmarYehiaDev commented 1 year ago

Okay so it's 2023 now. What package should I use exactly? the deadlines are so tight :"(

fabiancrx commented 1 year ago

@OmarYehiaDev , use the official packages from the pusher team https://pub.dev/publishers/pusher.com/packages

nicolasvahidzein commented 1 year ago

This one is dope: dart_pusher_channels

Emmanuel-Etukudo commented 1 year ago

Hi, I am kind of a noob at this @fabiancrx is there a way to set the host, wsport, wssPort on the official Pusher flutter package?

Korefey commented 9 months ago

Hi, I am kind of a noob at this @fabiancrx is there a way to set the host, wsport, wssPort on the official Pusher flutter package?

Hi @Emmanuel-Etukudo Did you find a solution for it?