---
title: "Deploy Socket.IO Server | (Just Updated) Realtime WebSockets, Token Auth and Emit API Generated"
description: "Realtime WebSocket server, token auth and emit API generated"
category: "Queues"
url: https://railway.com/deploy/socketio-server-or-just-updated-realtime
---

# Deploy Socket.IO Server | (Just Updated) Realtime WebSockets, Token Auth and Emit API Generated

Realtime WebSocket server, token auth and emit API generated

**[Deploy Socket.IO Server | (Just Updated) Realtime WebSockets, Token Auth and Emit API Generated on Railway](https://railway.com/template/socketio-server-or-just-updated-realtime)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/socketio-server-or-just-updated-realtime/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Queues

## Template content

### socketio

- **Image:** ghcr.io/bon5co/socketio-railway:4.8.4@sha256:2a59f49a190cb9f4fbc423ef8485466b3d44bd22c743fbb99742f9b048f888c6
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Socket.IO Server on Railway

Socket.IO is the most widely used realtime library for Node and browsers. This template deploys a ready-to-use Socket.IO 4.8 server: clients connect over WebSocket (with long-polling fallback), join rooms and receive events, and your backend pushes events with one HTTP call. The client token and the API key are generated for you, so nothing needs filling in.

## About Hosting Socket.IO Server

The image is a small wrapper (source: github.com/bon5co/socketio-railway) around the official `socket.io` package, pinned by digest. There is no official Socket.IO server image, so the wrapper adds what a hosted server needs: token authentication on every connection, an authenticated `POST /emit` endpoint for server-side publishing, a `/health` check and CORS control. It runs as a single stateless process; set `REDIS_URL` to enable the Redis adapter before scaling beyond one replica.

## Why Deploy Socket.IO Server on Railway?

- No manual step: secrets generated, port and health path wired up.
- Public HTTPS and WSS endpoint out of the box.
- Connections are authenticated from the first request, not open to the internet.
- Cheap to run: one small Node process, no database.

## Common Use Cases

- Chat, presence and live notifications for web and mobile apps.
- Streaming progress of long jobs or LLM agent output to a browser.
- Collaborative editing and live dashboards.
- Self-hosted replacement for Pusher, Ably or PubNub when your clients already use Socket.IO.

## Dependencies for Socket.IO Server Hosting

### Deployment Dependencies

- Image: [ghcr.io/bon5co/socketio-railway](https://github.com/bon5co/socketio-railway) (Socket.IO 4.8.4)
- Docs: https://socket.io/docs/v4/
- No database or volume needed.

## Machine-readable contract

```
service: socketio
base_url: https://
health: GET /health -&gt; 200
websocket: wss:///socket.io/   (client: io(URL, { auth: { token: SOCKETIO_CLIENT_TOKEN } }))
http_emit: POST /emit   header Authorization: Bearer    body {"event","data","room"?}
credential_variables:
  SOCKETIO_CLIENT_TOKEN  (clients send it as auth.token; wrong token -&gt; connect_error "unauthorized")
  SOCKETIO_API_KEY       (server-side emit)
optional_variables:
  SOCKETIO_CORS_ORIGINS  (comma list, default *)
  REDIS_URL              (enables Redis adapter for multiple replicas)
client_events: join(room), leave(room), publish({event,data,room?})
```

Push an event from your backend:

```
curl -X POST https:///emit \
  -H "Authorization: Bearer $SOCKETIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"event":"news","room":"lobby","data":{"hello":"world"}}'
```

Connect a client:

```js
const socket = io("https://", { auth: { token: "" } });
socket.emit("join", "lobby");
socket.on("news", console.log);
```

Allowed CORS origins default to `*`; set `SOCKETIO_CORS_ORIGINS` before production use.


## Similar templates

- [Celery | Web, Worker and Scheduler as Three Services](https://railway.com/deploy/celery-or-web-work-1) — Web, worker and scheduler wired up: Celery on Redis, outcomes in Postgres.
- [Redpanda](https://railway.com/deploy/redpanda-1) — Redpanda 26.2: Kafka-compatible streaming, single node, with Kafbat UI.
- [smoothmq](https://railway.com/deploy/AJv-64) — A drop-in replacement for AWS SQS

Open this page in a browser: https://railway.com/deploy/socketio-server-or-just-updated-realtime
