Closed robs007 closed 9 months ago
Maybe needs an upgrade of pusher/pusher-php-server
to ^7.0
I can try that, at one point I thought there were issues with pusher 7 and WebSockets and I had downgraded it.
composer require "beyondcode/laravel-websockets:dev-master" -W
"pusher-js": "^7.0",
"pusher/pusher-php-server": "^7.0",
Now it doesn't even work in edge. I loaded a completely new websockets site using the above suggestions and I can't even get the debug console to work, I get the same error message now in chrome and edge.
https://github.com/beyondcode/laravel-websockets-demo/pull/22
Yeah, that's basically what I have on the new server. "php": "^7.4|^8.0", "beyondcode/laravel-websockets": "dev-master", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.75", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5" }, And I still get this error when trying to connect from the debug console. pusher.min.js:8
WebSocket connection to 'wss://ws.skydivect.net:6002/app/e1508ade4104796fcff7?protocol=7&client=js&version=7.0.3&flash=false' failed: WebSocket is closed before the connection is established.
Console is showing this, so it looks like it's running ws@ws02:~/site$ php artisan websockets:serve --port=6002 Starting the WebSocket server on port 6002... Saving statistics... Saving statistics...
https://github.com/beyondcode/laravel-websockets-demo/pull/22
Not works?
You want me to load the demo?
I loaded the demo, it does the same thing, I get the same error. This worked so well for so long, now I just can't get it to work. Don't know what changed.
So, that actually does work when I'm on the local network, which would point to a firewall rule, but I haven't changed anything there in a long time. Well, at least I have a place to start looking now. Thanks for your help, the old version still doesn't work in chrome on the local network so I definitely need the upgrade. Thanks
In the end, it's not a firewall issue. The debug panel works outside the network and it receives broadcasts. But I still get an error on the client pages from pusher closing instantly and not being able to connect. Does the wss mean it's trying to connect securely? I have not set up SSL on the server side. The server does have a certificate, but I have done no WebSockets set up.
WebSocket connection to 'wss://ws.skydivect.net:6002/app/e1508ade4104796fcff7?protocol=7&client=js&version=7.0.3&flash=false' failed: WebSocket is closed before the connection is established.
Does the wss mean it's trying to connect securely?
Yes
workaraund https://github.com/beyondcode/laravel-websockets/issues/920#issuecomment-1010956181 #921
What controls it using wss over ws? Can I force it to use was?
It depends whether ur using https on not I think
Make sure the certificate is valid and the configuration too. Here's my part of broadcasting.php
Also websockets.php 'ssl' part:
Have the same problem, weirdly mine gets fixed when i restart my pc or server; haven't pinned down which is the cause. Works for most of people connected and then sometimes it just stops in some browsers (restarting browser does not help). since i use chrome (and edge is basically chrome) i dont know if this is also problem with firefox, but when testing, this is how i know it is one browser only. This happens to mostly in development: self signed certs, computer and vm going to sleep etc that can cause it. in prod it happens rarely and when it does i just restart the service and browser. Since dev did not support laravel 9, i switched over from ^2.0-dev to ^2.0.0-beta and am yet to see if it still occurs.
Day one it's working, the next day it's not, nothing changed in the code, and nothing changed in the server config! I was debugging the issue for hours and got bored solving it and went to get lunch when I returned it was gone same code same server, I don't know how could that happen and I am afraid it's gonna break again tomorrow
Guys I have never seen this websockets stuff work on production. I recommend seeking for alternatives coz it is semi abardoned, nkt! Try https://docs.soketi.app/.
I have had the websockets server running for a year with no issues. Last week for some reason it stopped working in chrome. It works fine in edge right now. Getting error wss://websockets.skydivect.net:6001/app/e1508ade4104796fcff7?protocol=7&client=js&version=4.3.1&flash=false' failed: WebSocket is closed before the connection is established. I get this error even on the websockets debug page. Running "beyondcode/laravel-websockets": "~2.0-dev" "laravel/framework": "^7.0", "pusher-js": "^5.1.1", "pusher/pusher-php-server": "~v4.1",