pusher_client
pusher_client copied to clipboard
I cannot get data
How I get data from Pusher to use them?
PusherOptions options = PusherOptions(
host: 'example.com,
wsPort: 6001,
wssPort: 6001,
encrypted: true,
auth: PusherAuth('https://example.com/api/broadcasting/auth',
headers: {
'Authorization': 'Bearer $token',
'Content-Type': 'application/json',
}),
);
PusherClient pusher = PusherClient('example', options,
enableLogging: true, autoConnect: false);
pusher.connect();
pusher.onConnectionStateChange((state) {
print(
"previousState: ${state!.previousState}, currentState: ${state.currentState}");
});
pusher.onConnectionError((error) {
print("error: ${error!.message}");
});
pusher.subscribe("private-Notification.${userId.toString()}").bind(
"Illuminate\\Notifications\\Events\\BroadcastNotificationCreated",
(event) {
print('Notification Data');
print(event!.data);
});
} on Exception catch (e) {
print('Error' + e.toString());
}
Result
W/FlutterJNI(32537): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: com.github.chinloyal/pusher_client_stream. Response ID: 0
D/PusherClientPlugin(32537): [ON_EVENT] Channel: private-Notification.441, EventName: Illuminate\Notifications\Events\BroadcastNotificationCreated,
D/PusherClientPlugin(32537): Data: {"data":"Hello"}, User Id: null
I think the owner of this library is too much busy :D I have also some issues what if we help each other ? Can your try BroadcastNotificationCreated instead of Illuminate\Notifications\Events\BroadcastNotificationCreated For me: Have you tested your app on ios using same library?