pusher_client
pusher_client copied to clipboard
com.pusher.client.AuthorizationFailureException: java.io.FileNotFoundException:
Hello I'm trying to authorize my pusher client but I keep getting this error: com.pusher.client.AuthorizationFailureException: java.io.FileNotFoundException: http://167.99.214.205/api/v1/broadcasting/auth.
Please what can I do?
Can you share your pusher configuration?
I have the same problem
Here's my Pusher config :
static PusherClient? pusher;
static Channel? channel;
static Future<void> initPusher(String token, int userId) async {
PusherOptions options = new PusherOptions(
cluster: 'eu',
auth: new PusherAuth(
'https://url',
headers: {
'authentication': '$token',
},
),
);
try {
pusher = new PusherClient("APP_KEY", options,
enableLogging: true, autoConnect: false);
pusher?.connect();
channel = pusher?.subscribe("private-user" + '$userId');
}catch(e) {
}
After hours of debugging i managed that the pusher client is sending the previous token to the server. (This error only happens when i connect with another account, if it was my first login everything is fine, but then the pusher sends the previous token rather than the new one if i use my second account)
I have the same problem
Here's my Pusher config :
static PusherClient? pusher; static Channel? channel; static Future<void> initPusher(String token, int userId) async { PusherOptions options = new PusherOptions( cluster: 'eu', auth: new PusherAuth( 'https://url', headers: { 'authentication': '$token', }, ), ); try { pusher = new PusherClient("APP_KEY", options, enableLogging: true, autoConnect: false); pusher?.connect(); channel = pusher?.subscribe("private-user" + '$userId'); }catch(e) { }
After hours of debugging i managed that the pusher client is sending the previous token to the server. (This error only happens when i connect with another account, if it was my first login everything is fine, but then the pusher sends the previous token rather than the new one if i use my second account)
I have the same problem
Do we have any solution on this problem?
Do we have any solution on this problem?
i suggest socket_io_client_2
Do we have any solution on this problem?
i suggest socket_io_client_2
Is it socket_io_client? I can't find socket_io_client_2
Do we have any solution on this problem?
i suggest socket_io_client_2
Is it socket_io_client? I can't find socket_io_client_2
socket_io_client: ^2.0.0-beta.4-nullsafety.0
Do we have any solution on this problem?
i suggest socket_io_client_2
Is it socket_io_client? I can't find socket_io_client_2
socket_io_client: ^2.0.0-beta.4-nullsafety.0
ok thanks
I'm having exactly the same problem. we're making a new instance of pusher client and giving it new options with new authentication token but still the client is sending the previous token (although the rest of the data is up to date, only the token is being persisted some how.) I think that's a problem of cached headers...
Anyone solved the issue?
I'm having exactly the same problem. we're making a new instance of pusher client and giving it new options with new authentication token but still the client is sending the previous token (although the rest of the data is up to date, only the token is being persisted some how.) I think that's a problem of cached headers...
Anyone solved the issue?
This may solve your problem , the commit 32ec432. The pull request is opened here
pusherclient has an instance stored in native code, even if you make a new instance of pusherclient, the native code still does null check on the native pusherclient instance.
to fix this, first change lib/src/pusher/pusher_client.dart to not reuse the same instance. i've commented out the part that needs to be replaced.
// String appKey,
// PusherOptions options, {
// bool enableLogging = true,
// bool autoConnect = true,
// });
/// Creates a [PusherClient] -- returns the instance if it's already be called.
// factory PusherClient(
// String appKey,
// PusherOptions options, {
// bool enableLogging = true,
// bool autoConnect = true,
// }) {
// // _singleton ??= PusherClient._(
// // appKey,
// // options,
// // enableLogging: enableLogging,
// // autoConnect: autoConnect,
// // );
//
// final initArgs = InitArgs(enableLogging: enableLogging);
//
// _singleton!._init(appKey, options, initArgs);
//
// if (autoConnect) _singleton!.connect();
//
// return _singleton!;
// }
PusherClient(
String appKey,
PusherOptions options, {
bool enableLogging = true,
bool autoConnect = true,
}) {
// Create a new instance directly inside the constructor
final initArgs = InitArgs(enableLogging: enableLogging);
_init(appKey, options, initArgs);
if (autoConnect) connect();
}
then modify the native init func to not null check the native pusherclient instance.
for android,
remove this from android/src.main/kotlin.com.github.chinloyal.pusher/pusher/PusherService.kt
if(_pusherInstance == null) {
for ios,
remove this from ios/Classes/PusherService.swift
if(_pusherInstance == nil) {