Coder Social home page Coder Social logo

Comments (5)

kerrsmith avatar kerrsmith commented on May 20, 2024

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.

lsfiege avatar lsfiege commented on May 20, 2024

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.

kerrsmith avatar kerrsmith commented on May 20, 2024

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.

lsfiege avatar lsfiege commented on May 20, 2024

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.

lsfiege avatar lsfiege commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.