Closed heshamerfan97 closed 3 years ago
any solution please
Same here. Works well on iOS but I get the same error on android. @mghase @chinloyal Any solution yet?
I gave up using this package, I tried flutter_pusher_client with laravel_echo and it worked for me.
@heshamerfan97 The issue was you are not using the full url for the authEndpoint, instead of "/broadcasting/auth" use "my-app.com/broadcasting/auth"
I'm using it with full url. With https://
@OxayMint Can you share your configuration?
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);
});
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
@chinloyal I already tried using the full link for auth. but the error is still there.
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
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.
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
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?
@heshamerfan97 can you also try this as well? I want to confirm this works so I can create a new release
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
This new release v1.1.1 fixes this issue as confirmed by @OxayMint so I am closing this issue for now.
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.
E/AndroidRuntime(15468): at i.a.a.h.
E/AndroidRuntime(15468): at i.a.a.h.b(Unknown Source:0)
E/AndroidRuntime(15468): at i.c.g.b.
E/AndroidRuntime(15468): at i.c.g.c.
E/AndroidRuntime(15468): at i.c.g.c.
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.
E/AndroidRuntime(15468): at i.b.g.b.
E/AndroidRuntime(15468): at i.b.g.b.
E/AndroidRuntime(15468): at i.b.g.b.
E/AndroidRuntime(15468): at i.b.f.b.
E/AndroidRuntime(15468): at c.h.a.g.f.a.
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
@mghase That is a completely different issue, I believe it's related to issue #3
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
...