kakajansh / echo

Laravel Echo for your Flutter apps.
MIT License
107 stars 68 forks source link

Not working in release #38

Closed rabichawila closed 2 years ago

rabichawila commented 3 years ago
Vesion: ^0.2.5

I built my signed APK (sha1) but i did not publish it to PlayStore yet. ( i didn't think it mattered), Now my application is not working in after building, but it does works fine on debug mode.

Here is how i get the instance of the singleton.

PusherSocket.init(authToken: _authToken);
Echo  echo = PusherSocket.instance;

Here is my singleton code:

pusher_socket.dart


class PusherSocket {
  static Echo _echo;
  static PusherSocket _pusherSocket;

  PusherSocket._instance() {
    print("initializing echo");
  }

  static Echo get instance {
    return _echo;
  }

  static Echo init({String authToken}) {
    if (_pusherSocket == null) {
      PusherAuth _auth;
      if (authToken != null) {
        _auth = PusherAuth(
          'https://example.com/broadcasting/auth',
          headers: {
            'Authorization': '$authToken',
          },
        );
      }

      PusherOptions options = PusherOptions(
        host: wsURL,
        port: wsPort,
        encrypted: true,
        auth: _auth != null ? _auth : null,
        cluster: cluster,
      );

      FlutterPusher pusher =
          FlutterPusher(wsKey, options, enableLogging: false);

      _echo = new Echo({
        'broadcaster': 'pusher',
        'client': pusher,
      });

      // initialzie
      _pusherSocket = PusherSocket._instance();
    }
  }
}
Fraganya commented 2 years ago

having a similar issue.

Fraganya commented 2 years ago

Tried this solution and it seems to be working.

https://stackoverflow.com/questions/63939157/chat-using-laravel-echo-in-my-flutter-app

kakajansh commented 2 years ago

Not directly related to this package