Replies: 4 comments 4 replies
-
To get your Laravel + Lighthouse + Pusher subscription setup working with Flutter, it's important to ensure all components are properly configured and compatible. Based on your detailed description, here are some common issues and their solutions:
Laravel WebSocket Package:
Start the WebSocket server:
If you're deploying to production, use:
Then, verify that jobs are being dispatched and processed. Check jobs table logs if you're using the database queue.
}` Ensure you’ve registered this subscription in the lighthouse.php config.
For local:
For production (Pusher):
Manually Test Events: Test Pusher by broadcasting a manual event to see if it reaches the Pusher console:
Example:
Combine them:
Conclusion |
Beta Was this translation helpful? Give feedback.
-
I tried to implement your tips, including insert 'subscription_url' into "config/graphiql.php" Now when I try to register the subscription with graphiql, the error message "{ "errors": [ {"isTrusted": true} ] }" appears. I always start the reverb server with: At no time do error messages appear in the output. From my point of view, the reverb server is working properly. But the result of I have to use the following URL: but also with When I create a new blog, the following happens I tried to access the reverb server via a livewire/echo app instead of lighthouse/graphql. That works. But then I wouldn't be able to use lighthouse broadcasting at all. Do you have another tip for me? |
Beta Was this translation helpful? Give feedback.
-
Now I have made another attempt. When I use "GRAPHIQL_SUBSCRIPTION_ENDPOINT="ws://127.0.0.1:8099/app/zbtonb7eoebrcbzi5rfi"" and starts the graphql-query to register the subscription, appears in the reverb-output: "Connection Established ..... 276975131.803874006" and "Connection Closed ..... 276975131.803874006". But in the end it remains with the error message "{ "errors": [ {"isTrusted": true} ] }". Propably it's only a java script error, because the client can't parse the error-message or there is a empty message. At least that's what I got from this link: While I run the "Subscription registration" test in graphiql, an empty websocket response appears in the chrome developer tool. |
Beta Was this translation helpful? Give feedback.
-
First of all, thank you very much again for your patient support! And I have a question about your last post: But route:list nevertheless shows: GET|POST|HEAD graphql ....................................... graphql › Nuwave\Lighthouse › GraphQLController and the base data for this route stands in config/lighthouse.php Should route:list also show a websocket route ? |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm a complete beginner, unfortunately with Laravel, also with Lighthouse, and with Pusher. I want to develop a mobile app with Flutter that should communicate with a Laravel backend via graphQL. The queries and mutations work. Subscriptions don't work at all, no matter what I do. Can anyone give me a tip?
Currently I am trying to get the following configuration to work:
First, I created a completely new laravel project, via:
I've added
Nuwave\Lighthouse\Subscriptions\SubscriptionServiceProvider::class,
in bootstrap\providers.php.I've created two models, author and blog, as well as a, in my opinion, suitable scheme:
In .env I defined the pusher variables:
The mutation:
works. It always creates a new record in the database. The job
Nuwave\Lighthouse\Subscriptions\BroadcastSubscriptionJob
is queued and is executed shortly afterwards. There are no errors in the laravel.log. But nothing appears in the pusher debug console.Before that, I start the subscription:
in the hope that this will notify me of the new blog-entry. Nothing happens via the Altair GraphQL client. This request also does not arrive in the pusher debug console. Via graphiQL, the connection breaks immediately or is not established at all, the error message is:
"errors": [ { "isTrusted": true } ]
The functions authorize and filter of class BlogInserted (extends GraphQLSubscription) returns constant true.
Because I'm not sure, I'm testing with two different subscriptions URLs:
a.)
GRAPHIQL_SUBSCRIPTION_ENDPOINT="ws://127.0.0.1:8801/graphql"
b.)
GRAPHIQL_SUBSCRIPTION_ENDPOINT="wss://ws-${PUSHER_APP_CLUSTER}.pusher.com:443/app/${PUSHER_APP_KEY}?protocol=7"
Does anyone have an idea how I can find my mistake?
Beta Was this translation helpful? Give feedback.
All reactions