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

Issues running the Pusher service in a background task #141

Open
henry-ht opened this issue Dec 30, 2023 · 9 comments
Open

Issues running the Pusher service in a background task #141

henry-ht opened this issue Dec 30, 2023 · 9 comments

Comments

@henry-ht
Copy link

henry-ht commented Dec 30, 2023

I have set up a stable connection with a server running Laravel. When the application is open, it receives and notifies the logged-in user when a new message has arrived.

To run a background task, I am using the 'workmanager' package, which is very easy to configure. I have tested it by sending a local notification with the 'flutter_local_notifications' package, and it works correctly even when the application is completely closed. In other words, the notification is displayed on the mobile device.

When I use Pusher, I get the following error upon execution: _pusher.subscribe(channelName: "private-channel"), it throws the following error:

Pusher authorize error: java.lang.NullPointerException

Any idea on how to solve it, please help me.

@benw-pusher
Copy link

can you share the configuration / code in use for the Pusher setup?

@henry-ht
Copy link
Author

henry-ht commented Jan 3, 2024

can you share the configuration / code in use for the Pusher setup?

image

image

image

W/FlutterJNI(23468): FlutterJNI.init called more than once I/PusherChannelsFlutter(23468): Start com.pusher.client.Pusher@8f2c669 W/System.err(23468): SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". W/System.err(23468): SLF4J: Defaulting to no-operation (NOP) logger implementation W/System.err(23468): SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. I/flutter (23468): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (23468): │ #0 PusherService.init (package:pakage/src/services/pusher_service.dart:41:16) I/flutter (23468): │ #1 <asynchronous suspension> I/flutter (23468): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ I/flutter (23468): │ 💡 init socket DISCONNECTED I/flutter (23468): └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/PusherChannelsFlutter(23468): Pusher authorize error: java.lang.NullPointerException I/flutter (23468): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (23468): │ #0 callbackDispatcher.<anonymous closure> (package:pakage/main.dart:48:14) I/flutter (23468): │ #1 <asynchronous suspension> I/flutter (23468): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ I/flutter (23468): │ 💡 Info log 69 I/flutter (23468): └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── D/FlutterGeolocator(23468): Flutter engine disconnected. Connected engine count 1 D/FlutterGeolocator(23468): Disposing Geolocator services E/FlutterGeolocator(23468): Geolocator position updates stopped E/FlutterGeolocator(23468): There is still another flutter engine connected, not stopping location service I/WM-WorkerWrapper(23468): Worker result SUCCESS for Work [ id=8546fcda-07b9-426e-b317-1432157f5633, tags={ dev.fluttercommunity.workmanager.BackgroundWorker } ]

@henry-ht
Copy link
Author

henry-ht commented Jan 3, 2024

This is running the Pusher connection outside of the background tasks.

image

@henry-ht
Copy link
Author

@benw-pusher please answer me?

@benw-pusher
Copy link

Just to confirm the situation: this works when not using workermanager but doesn't succeed when this is in place - is that correct?

@henry-ht
Copy link
Author

Just to confirm the situation: this works when not using workermanager but doesn't succeed when this is in place - is that correct?

it is correct

@vasilich6107
Copy link

vasilich6107 commented Jan 17, 2024

Sorry for interrupting @benw-pusher
but no one takes a look at PR #140

@henry-ht
Copy link
Author

@benw-pusher Sorry, is it possible to find a solution, or should I give up hope?

@henry-ht
Copy link
Author

henry-ht commented Feb 9, 2024

@benw-pusher no me respondes?, no me dices nada?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants