Comments (5)
After a bit of searching around I have now got it working - I did the following:
The Let's Encrypt certificates used by ISPConfig are only readable by root so I tested them by just copying them to my user's home folder.
I then followed the setup guide for the 'Usage with Laravel Valet', this meant adding:
wssPort: 6001, to the Echo code:
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
//cluster: process.env.MIX_PUSHER_APP_CLUSTER,
//encrypted: true,
wsHost: window.location.hostname,
wsPort: 6001,
wssPort: 6001,
disableStats: true
});
and
'scheme' => 'https' as well as the curl options to broadcasting.php
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
//'encrypted' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
]
],
],
Next in websockets.php I changed by certificate locations and added in 'verify_peer' => false,
'ssl' => [
/*
- Path to local certificate file on filesystem. It must be a PEM encoded file which
- contains your certificate and private key. It can optionally contain the
- certificate chain of issuers. The private key also may be contained
- in a separate file specified by local_pk.
/
'local_cert' => '/my/home/directory/ssl/example.com-le.crt',
/ - Path to local private key file on filesystem in case of separate files for
- certificate (local_cert) and private key.
/
'local_pk' => '/my/home/directory/ssl/example.com-le.key',
/ - Passphrase for your local_cert file.
*/
'passphrase' => null,
'verify_peer' => false,
],
Once this was done it all started working in both Firefox and Chrome. Basically it was failing because it could not read my certificates as they were not accessible to my webserver user.
from laravel-websockets.
I have the same problem as you. But when trying to connect to the websocket, I get the following error failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
. I also have debian, letsencrypt and the same configurations.
from laravel-websockets.
This could mean the port you are trying to connect to is closed. Does the connection work when you are not using SSL? If it does then it must be something to do with the SSL setup - have you followed the setup for SSL on the following page:
https://docs.beyondco.de/laravel-websockets/1.0/basic-usage/ssl.html#usage-with-laravel-valet
Even if you are not using Laravel Valet this setup is a good place to start, you need to do everything it says as some parts make it work in Firefox and others Chrome.
Have you checked that the port is actually open in Debian:
lsof -nPi tcp:6001
this command should output something similar to the following:
php 12832 webuser 6u IPv4 27154618 0t0 TCP *:6001 (LISTEN)
I would double check the above as a start and see if everything looks correct.
from laravel-websockets.
Yes, it works without ssl and the port is open. Even the result of lsof is similar to the one you have indicated to me. It seems to be a configuration of letsencrypt / ssl on my server, although I have not yet found which one is.
I have noticed that there was an update on my server and some problems with curl versions, maybe I should try another vps to discard this.
EDIT:
Finally, I have done the same thing in another VPS and it works correctly. The problem here is my Debian. Sorry
from laravel-websockets.
I have come back here because maybe someone knows that this problem may be caused. When executing the php artisan websockets:serve
command, and checking on the other hand if indeed this command works on port 6001, the lsof -nPi tcp:6001
command returns nothing. I have investigated a little about what could be due, but without success. I have also verified that the port is open running netstat -pln
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN -
from laravel-websockets.
Related Issues (20)
- So there is no way to use this package in my project HOT 1
- which version is everyone using? 1, 2 or dev-master? HOT 12
- Unhandeled promise rejection! HOT 4
- InvalidArgumentException - WebSocketStatisticsEntriesController@store HOT 1
- production.ERROR: Pusher error: cURL error 7: Failed to connect to websockets port 4005: Connection refused
- Redis replication configuration is missing HOT 2
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 1048576 bytes)
- channel routes not work HOT 5
- prevent error if server is not running
- websocket closed before connection established
- I have not received socket message when used laravel broadcast when i use laravel websocket ui then i have receviced message. HOT 2
- Laravel. Error when working on Ubuntu "WebSocket connection to 'wss://.....' failed: WebSocket is closed before the connection is established." HOT 1
- Laravel WebSockets and nWidart Modules
- Illuminate\Broadcasting\BroadcastException: Pusher error: 404 Not Found HOT 2
- WebSocket is closed before the connection is established in Production
- Works with ionic live reload but handshake cannot establish when it doesn't run in live reload
- Incorrect "auth" structure make the service goes down HOT 1
- Compatibility with Laravel Herd on secured test domains HOT 1
- Project dead ?! HOT 9
- content of websockets.php is different than described HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-websockets.