[Soketi](https://docs.soketi.app) is a simple, fast, and resilient open-source WebSocket server written in Typescript. It’s fully compatible with the Pusher v7 protocol which makes it a viable replacement to Pusher when using [Laravel Echo](https://github.com/laravel/echo).

In this blog post we’re going to learn how to deploy Soketi to a server managed by [Laravel Forge](https://forge.laravel.com). We suggest using the “Web Server” server type when creating this server in Forge as Web servers include Node, NPM, and Nginx.

### Opening Ports

After creating the server, we need to open port `6001` on the server so that the PusherJS / Echo client can connect to the Soketi server that we will install later.

To open the port, head over to the Network panel in Forge, create a new Rule named “Soketi Server”, and set the port to `6001`. The Rule Type should be set to “Allow”.

![Opening Port 6001](https://laravel-blog-assets.s3.amazonaws.com/niC9qpKRP4KSMGhZskb3HnGgpZDjXWJRFceFrb4G.png “Opening Port 6001”)

### Installing Soketi

Before we can run Soketi, we need to install it on our server. Because Soketi is an NPM package, we can run the following command to install it:

“`
npm install -g @soketi/soketi
“`

> Alternatively, you may use Yarn to install Soketi.

We can verify that Soketi is installed by running `soketi start` in the terminal. If Soketi is not installed or its default port of `6001` is in use then you may receive an error when executing the `start` command.

### Configuring The Daemon

After installing Soketi, we can configure a Daemon on our server that will keep the service running and restart it if it crashes.

Let’s head over to Forge, then navigate to the server’s **Daemons** panel. To create the Daemon, there are a couple of things we need to do:

1. Set the Command to `soketi start`
2. Change the Stop Seconds to `60`
3. Change the Stop Signal to `SIGINT`

![Creating The Soketi Daemon](https://laravel-blog-assets.s3.amazonaws.com/XYj16mlnaIHVWrDQmoSH5DlX4vMfwoA9JMKB1BI0.png “Creating The Soketi Daemon”)

Once created, we can verify that Soketi is running by clicking the three dots next to the Daemon in the “Active Daemons” table and then clicking the “Show Daemon Log” button.

![Checking The Soketi Service](https://laravel-blog-assets.s3.amazonaws.com/KO1xu2mqAzFiPpwBXnI4wnL1IamEqC97bJMnJ58G.png “Checking The Soketi Service”)

Great! Soketi is running perfectly.

> For a more advanced setup instructions, check out the [Soketi documentation](https://docs.soketi.app). You may modify the command to change drivers, enable SSL support, turn on debugging, and more.

### Configuring Our Site

With Soketi now installed and configured, we can update our Laravel application to connect to our Soketi server. We’ll update our `.env` file with the new configuration details:

“`
PUSHER_APP_KEY=app-key
PUSHER_APP_ID=app-id
PUSHER_APP_SECRET=app-secret
PUSHER_HOST=127.0.0.1
PUSHER_PORT=6001

MIX_PUSHER_APP_KEY=”${PUSHER_APP_KEY}”
MIX_PUSHER_HOST=”${PUSHER_HOST}”
MIX_PUSHER_PORT=”${PUSHER_PORT}”
“`

> By default, Soketi starts a server using `app-key`, `app-id`, and `app-secret` credentials. You can change these using [Soekti environment variables](https://rennokki.gitbook.io/soketi-docs/app-management/array-driver#environment-variables).

Finally, you should change the `PUSHER_HOST` environment variable to the IP address of your Forge server. Your project should now be able to connect to the Soketi server.

0 Shares:
You May Also Like

Forge: MariaDB 10.6 and PostgreSQL 14

We’re happy to announce the immediate availability of [MariaDB 10.6](https://mariadb.com/kb/en/changes-improvements-in-mariadb-106/) and [PostgreSQL 14](https://www.postgresql.org/about/news/postgresql-14-released-2318/) database versions on Laravel Forge.…