Custom WebSocket Server

If you don't want to use Pusher as your WS server which is the default one, then you can follow one of the options bellow to configure your app and get it running with your custom server

beyondcode/laravel-websockets

To replace Pusher with beyondcode/laravel-websockets you have to install & configure it with your app.. then modify your app's .env file as following:

config/chatify.php

PUSHER_APP_ID=pusher_app_id                           # Any random string
PUSHER_APP_KEY=pusher_app_key                         # Any random string
PUSHER_APP_SECRET=pusher_app_secret                   # Any random string
PUSHER_HOST=127.0.0.1                                 # Server host
PUSHER_PORT=6001                                      # Server port
PUSHER_SCHEME=http                                    # For SSL use `https`, otherwise use `http`.
PUSHER_APP_CLUSTER=mt1
LARAVEL_WEBSOCKETS_PORT="${PUSHER_PORT}"              # Laravel WS port

LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=private_key_path      # Optional for using SSL.
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=certificate_path    # Optional for using SSL.

then also you have to modify laravel-websockets config file to enable client events which is required to get it working well:

You can make changes on this config file as your needs for other options available.

config/websockets.php
...
'apps' => [
        [
            ...
            'enable_client_messages' => true,         # Set to `true`
            ...
        ],
    ],
...

and make sure you're running the websockets server.

That's all you need 🚀.

if you change the env variables or any related config, then you may need to restart your websockets server.

Other WS servers

For other WS servers you can follow same as the options above and what required by the custom server you're trying to use.

Last updated