Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Events are not being broadcasted unless I open Dashboard #24

Closed
antonioribeiro opened this issue Dec 6, 2018 · 4 comments
Closed

Events are not being broadcasted unless I open Dashboard #24

antonioribeiro opened this issue Dec 6, 2018 · 4 comments

Comments

@antonioribeiro
Copy link

Took me a while to figure it out. It was, at first, looking like it was not working at all. I had just installed it and configured like I use to do with Pusher, then added the proper ports and so, but nothing was hitting the terminal log, so I finally opened the dashboard, then magically events started to show up on the terminal and the front end.

So I disconnected the dashboard, closed the page and created and, after a while, created a new event, which again was not showing up on terminal, so I opened the dashboard and voilá! there was it, working.

Then I moved to my home machine, git pull, composer install, migrate, npm run watch, opened the interface, it connected successfully to the server, but not a single event is showing in terminal log, all I get is ping and pongs.

@antonioribeiro
Copy link
Author

Never mind. My bad.

@bhulsman
Copy link

bhulsman commented Dec 6, 2018

@antonioribeiro What did you do wrong?

My situation is like this, very similar:

Run php artisan websockets:serve, then open website with Echo on it. It fails so connect to socket, I see a disconnect message where I'm running websockets:serve. But when opening the dashboard and hitting 'connect', suddenly it works.

@antonioribeiro
Copy link
Author

Still unsure, but this time it got back working without connecting the dashboard, so I have to assume it's something I'm doing, or not doing... Moving to Pusher to test if things are working helped make it get back to normal too

@antonioribeiro
Copy link
Author

Some tips:

  • Check if you are broadcasting (order.1) and listening (order.1) to the very same channel
  • Check if the event name (OrderUpdated) is correct, double check them
  • Check if the server is up and you can connect to it
  • Execute telnet <websockets server hostname or ip> 6001 to test the connection
  • If you are using ngrok to test, you may have to change echoConfig.wsHost = window.location.hostname to your physical IP address
  • MIX_PUSHER_??? variables get cached weirdly, and sometimes reloading the page, config:clear, cache:clear, and whatever else is not enough, so:
  • Config variable types are strict: encrypted: 'true' will raise errors, it must be encrypted: true or encrypted: process.env.MIX_PUSHER_ENCRYPTED === 'true'
  • When moving from Pusher to Laravel Websockets or after editing your .env:
    • Delete app.js
    • Re-run npm run watch, because only forcing a rerun doesn't work sometimes
  • Don't forget to hard reload your browser tab just in case

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

No branches or pull requests

2 participants