Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pusher stuck in [CONNECTING] and produce a fatal exception. #4

Closed
heshamerfan97 opened this issue Dec 8, 2020 · 18 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@heshamerfan97
Copy link

Steps to reproduce

I use pusher_client: ^1.1.0 with laravel_echo: ^0.2.8
I Initialize PusherClient as the example
PusherOptions options = PusherOptions( host: '****-app.com', wssPort: 6001, wsPort: 6001, cluster: "mt1", ); PusherClient(appKey, options);

In initState I initialize my echo
echo = new Echo({ 'broadcaster': 'pusher', 'crsfToken': $accessToken, 'X-CSRF-TOKEN': $accessToken, 'authEndpoint': '/broadcasting/auth', 'key': appKey, 'wsHost': '****-app.com', 'wsPort': 6001, 'wssPort': 6001, 'forceTLS': true, 'disableStats': false, 'enabledTransports': ['ws', 'wss'], 'cluster': 'mt1', 'client': pusherClient, 'auth': { 'headers': { 'Authorization': 'Bearer $accessToken' } } });

Expected behavior

As an expected behavior it should at least connect to the socket and proceed through the [CONNECTING] message so I can connect to the channel.

Actual behavior

PusherClient stuck in [CONNECTING] and produce a fatal exception as follow

FATAL EXCEPTION: pusher-java-client eventQueue
E/AndroidRuntime( 5489): Process: com.**.****, PID: 5489
E/AndroidRuntime( 5489): java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter code
E/AndroidRuntime( 5489): at com.github.chinloyal.pusher_client.pusher.listeners.ConnectionListener.onError(Unknown Source:7)
E/AndroidRuntime( 5489): at com.pusher.client.connection.websocket.WebSocketConnection$5.run(WebSocketConnection.java:238)
E/AndroidRuntime( 5489): at com.pusher.client.util.Factory$1.run(Factory.java:119)
E/AndroidRuntime( 5489): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime( 5489): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime( 5489): at java.lang.Thread.run(Thread.java:919)

...

@mghase
Copy link

mghase commented Jan 9, 2021

any solution please

@OxayMint
Copy link

Same here. Works well on iOS but I get the same error on android. @mghase @chinloyal Any solution yet?

@heshamerfan97
Copy link
Author

I gave up using this package, I tried flutter_pusher_client with laravel_echo and it worked for me.

@chinloyal
Copy link
Owner

@heshamerfan97 The issue was you are not using the full url for the authEndpoint, instead of "/broadcasting/auth" use "my-app.com/broadcasting/auth"

@OxayMint
Copy link

I'm using it with full url. With https://

@chinloyal
Copy link
Owner

@OxayMint Can you share your configuration?

@OxayMint
Copy link

OxayMint commented Jan 19, 2021

PusherOptions options = PusherOptions(
      host: 'wss.{custom-hostname}',
      wsPort: 6001,
      wssPort: 6001,
      encrypted: true,
      auth: PusherAuth(
        'https://{custom-hostname}/broadcasting/auth',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer ' + LocalData.getInstance.getToken()
        },
      ),
    );
    pusherClient = PusherClient('any', options, autoConnect: true);

    pusherClient.onConnectionStateChange((state) {
      print(state.currentState);
    });

@OxayMint
Copy link

the thing is that we use custom pusher server. And everything works like a charm when I run it on iOS, but fails on android both emulator and real device

@heshamerfan97
Copy link
Author

@chinloyal I already tried using the full link for auth. but the error is still there.

@chinloyal
Copy link
Owner

Can you try setting this:

pusherClient.onConnectionError((error) {
   log("error: ${error.message}");
});

Let me know what happens, also can you set the enableLogging to true on the PusherClient to true @OxayMint

@OxayMint
Copy link

OxayMint commented Jan 19, 2021

D/PusherClientPlugin(13435): Pusher initialized
D/PusherClientPlugin(13435): [CONNECTING]
E/AndroidRuntime(13435): FATAL EXCEPTION: pusher-java-client eventQueue
E/AndroidRuntime(13435): Process: ventures.al.mashinal, PID: 13435
E/AndroidRuntime(13435): java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter code
E/AndroidRuntime(13435): 	at com.github.chinloyal.pusher_client.pusher.listeners.ConnectionListener.onError(Unknown Source:7)
E/AndroidRuntime(13435): 	at com.pusher.client.connection.websocket.WebSocketConnection$5.run(WebSocketConnection.java:238)
E/AndroidRuntime(13435): 	at com.pusher.client.util.Factory$1.run(Factory.java:119)
E/AndroidRuntime(13435): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(13435): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(13435): 	at java.lang.Thread.run(Thread.java:919)
D/PusherClientPlugin(13435): [RECONNECTING]
I/Process (13435): Sending signal. PID: 13435 SIG: 9
Lost connection to device.

@chinloyal
Copy link
Owner

chinloyal commented Jan 19, 2021

I believe a recent PR fixes this issue. I haven't created a release for it yet but you can test it out by linking to master in your pubspec.yaml file by doing:

dependencies:
  pusher_client:
    git:
      url: https://github.com/chinloyal/pusher_client
      ref: master

Let me know if that works @OxayMint

@OxayMint
Copy link

Yay! It worked. Thank you so much for this package and for resolving the issue!
Should we just wait for the new version of the package then?

@chinloyal
Copy link
Owner

@heshamerfan97 can you also try this as well? I want to confirm this works so I can create a new release

@chinloyal
Copy link
Owner

Yay! It worked. Thank you so much for this package and for resolving the issue!
Should we just wait for the new version of the package then?

Yes, I'll create the new release today

@chinloyal chinloyal added this to In progress in Pusher Client for Flutter Jan 19, 2021
@chinloyal chinloyal added the bug Something isn't working label Jan 19, 2021
@chinloyal
Copy link
Owner

This new release v1.1.1 fixes this issue as confirmed by @OxayMint so I am closing this issue for now.

@mghase
Copy link

mghase commented Jan 20, 2021

still geting fatal error. it work fine on debug mode but in release fails in Android

E/AndroidRuntime(15468): FATAL EXCEPTION: pusher-java-client eventQueue
E/AndroidRuntime(15468): Process: com.xxxx.xxxx, PID: 15468
E/AndroidRuntime(15468): java.lang.NoClassDefFoundError
E/AndroidRuntime(15468): at i.a.a.b.a(Unknown Source:8)
E/AndroidRuntime(15468): at i.a.a.b.(Unknown Source:6)
E/AndroidRuntime(15468): at i.a.a.h.(Unknown Source:2)
E/AndroidRuntime(15468): at i.a.a.h.b(Unknown Source:0)
E/AndroidRuntime(15468): at i.c.g.b.(Unknown Source:10)
E/AndroidRuntime(15468): at i.c.g.c.(Unknown Source:5)
E/AndroidRuntime(15468): at i.c.g.c.(Unknown Source:2)
E/AndroidRuntime(15468): at i.c.g.c.c(Unknown Source:0)
E/AndroidRuntime(15468): at i.c.c.a(Unknown Source:14)
E/AndroidRuntime(15468): at i.c.c.g(Unknown Source:0)
E/AndroidRuntime(15468): at i.c.c.e(Unknown Source:14)
E/AndroidRuntime(15468): at i.c.c.a(Unknown Source:0)
E/AndroidRuntime(15468): at i.c.c.a(Unknown Source:4)
E/AndroidRuntime(15468): at i.b.g.b.(Unknown Source:5)
E/AndroidRuntime(15468): at i.b.g.b.(Unknown Source:3)
E/AndroidRuntime(15468): at i.b.g.b.(Unknown Source:11)
E/AndroidRuntime(15468): at i.b.g.b.(Unknown Source:4)
E/AndroidRuntime(15468): at i.b.f.b.(Unknown Source:2)
E/AndroidRuntime(15468): at c.h.a.g.f.a.(Unknown Source:0)
E/AndroidRuntime(15468): at c.h.a.i.b.a(Unknown Source:2)
E/AndroidRuntime(15468): at c.h.a.g.f.b.h(Unknown Source:6)
E/AndroidRuntime(15468): at c.h.a.g.f.b.b(Unknown Source:0)
E/AndroidRuntime(15468): at c.h.a.g.f.b$a.run(Unknown Source:12)
E/AndroidRuntime(15468): at c.h.a.i.b$a.run(Unknown Source:7)
E/AndroidRuntime(15468): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(15468): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(15468): at java.lang.Thread.run(Thread.java:764)
E/AndroidRuntime(15468): Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
E/AndroidRuntime(15468): at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(15468): at java.lang.Class.forName(Class.java:453)
E/AndroidRuntime(15468): at java.lang.Class.forName(Class.java:378)
E/AndroidRuntime(15468): at i.a.a.b.a(Unknown Source:0)
E/AndroidRuntime(15468): ... 26 more
E/AndroidRuntime(15468): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.log4j.Category" on path: DexPathList[[zip file "/data/app/com.xxx.xxx-RF5Xws02UKrIBerUdhtOYQ==/base.apk"],nativeLibraryDirectories=[/data

@chinloyal
Copy link
Owner

@mghase That is a completely different issue, I believe it's related to issue #3

@chinloyal chinloyal moved this from In progress to Done in Pusher Client for Flutter Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

4 participants