Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while use Soketi in production #673

Closed
RabieAli95 opened this issue Aug 25, 2022 · 8 comments
Closed

Error while use Soketi in production #673

RabieAli95 opened this issue Aug 25, 2022 · 8 comments

Comments

@RabieAli95
Copy link

RabieAli95 commented Aug 25, 2022

I just deployed Soketi on EC2 with all its things (SSL, config Nginx proxy and etc) and I got a response in my domain (OK) which returns from Soketi so I assume all things are just fine! the domain (realtime.my_doamin.co). I connected with the client side and the Network is:
Screen Shot 2022-08-25 at 9 09 25 AM

On the server-side I got a weird error:

Pusher error:.

Full error: https://ibb.co/FJpnKs2

Here is the way I used it with Laravel:

in .env file

PUSHER_APP_KEY=app-key
PUSHER_APP_ID=app-id
PUSHER_APP_SECRET=app-secret
PUSHER_HOST=realtime.my_doamin.co
PUSHER_PORT=80

in bootstrap.js file:

window.Echo = new Echo({
    broadcaster: "pusher",
    key: "app-key",
    wsHost: "realtime.my_doamin.co",
    wsPort: 80,
    wssPort: 443,
    forceTLS: "https",
    enabledTransports: ["ws", "wss"],
});

window.Echo.channel("orders").listen("OrderStatusUpdated", (e) => {
    console.log(e);
});

In config/broadcasting.php file:

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY', 'app-key'),
            'secret' => env('PUSHER_APP_SECRET', 'app-secret'),
            'app_id' => env('PUSHER_APP_ID', 'app-id'),
            'options' => [
                'host' => env('PUSHER_HOST', '127.0.0.1'),
                'port' => env('PUSHER_PORT', 6001),
                'scheme' => env('PUSHER_SCHEME', 'http'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
        ],

In OrderStatusUpdated.php file:

class OrderStatusUpdated implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public function __construct(public $id)
    {
    }

    public function broadcastOn()
    {
        return new Channel('orders');
    }
}

in web.php file:

class Order
{
    public function __construct(public $id)
    {
    }
}

Route::get('/', function () {
    return view('welcome');
});

Route::get('/test', function () {
    OrderStatusUpdated::dispatch(new Order(1));

    return 'Event has been sent!';
});

I think there is a problem with SSL on the server side in the Laravel project.

I used Certbot to install SSL for the Soketi server

Here in docs SSL I did not do anything like it! Should I?

@RabieAli95 RabieAli95 added the goal:fix Something isn't working label Aug 25, 2022
@DarkGhostHunter
Copy link

Almost the same here. No error though.

Soketi works, Laravel pushes the event through one of the workers, but Soketi does not return it to the front end, like it never received something to push.

@RabieAli95
Copy link
Author

@DarkGhostHunter Beside the above issue I've got the same issue with no receiving data in frontend!

@DarkGhostHunter
Copy link

DarkGhostHunter commented Aug 27, 2022 via email

@RabieAli95
Copy link
Author

@DarkGhostHunter NICE!
just a question pls, how did you install the SSL on your server? and is there anything I have to config with Soketi after installing SSL on the server?

I just installed SSL by Certbot I do not know whether this is the right or wrong way!

@RabieAli95
Copy link
Author

@DarkGhostHunter How to check!

Screen Shot 2022-08-27 at 2 40 23 PM

Screen Shot 2022-08-27 at 2 40 15 PM

@DarkGhostHunter
Copy link

I'm using a load balancer / proxy in front. SSL config is in the documentation. From there your on your own, but as far as I remember certbot saves the SSL certificates and keys somewhere, you just have to find them. From there you're on your own. I recommend you investigate using a load balancer or proxy instead of manually configuring SSL for each app and domain, like Traefik or Caddy.

To debug Soketi you need to use SOKETI_DEBUG=1. The debug information will be shown on the process output, not on the WebSockets connection.

@RabieAli95
Copy link
Author

@DarkGhostHunter Pls I got confused with config Soketi with SSL

I need to create a JSON config file and put these into the file

SOKETI_SSL_CERT
SOKETI_SSL_KEY
SOKETI_SSL_PASS
SOKETI_SSL_CA

then run soketi start --config=/path/to/config.json to that config. Is that right?

@DarkGhostHunter
Copy link

You may hire someone to do that for you if it seems too difficult to configure.

@rennokki rennokki removed the goal:fix Something isn't working label Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants