Using Relay with Any Pusher SDK
Relay implements the full Pusher WebSocket and HTTP API protocol. Any SDK, library, or tool built for Pusher works with Relay — just change the host.
Skip the server setup. Relay Cloud gives you managed WebSockets with a free tier. Connect in 60 seconds.
Try free →
Relay is fully compatible with the Pusher protocol. This means you don't need a Relay-specific SDK — if Pusher has an SDK for your language or framework, it works with Relay right now. The only change is pointing the host at your Relay server instead of Pusher's servers.
Universal Config Pattern
Every Pusher SDK accepts host/port overrides. The three things that change for any SDK:
| Setting | Value |
|---|---|
| Host | ws.relaycloud.dev (or your self-hosted server) |
| Port | 443 |
| TLS | Enabled |
| App Key | From your Relay Cloud dashboard |
| App Secret | From your Relay Cloud dashboard (server-side only) |
SDK Quick Reference
PHP (pusher/pusher-php-server)
$pusher = new Pusher\Pusher(
'your-app-key',
'your-app-secret',
'your-app-id',
[
'host' => 'ws.relaycloud.dev',
'port' => 443,
'scheme' => 'https',
]
);
JavaScript / Node.js (pusher-js client)
const pusher = new Pusher('your-app-key', {
wsHost: 'ws.relaycloud.dev',
wsPort: 443,
wssPort: 443,
forceTLS: true,
disableStats: true,
enabledTransports: ['ws', 'wss'],
});
Node.js Server (pusher npm package)
const Pusher = require('pusher');
const pusher = new Pusher({
appId: 'your-app-id',
key: 'your-app-key',
secret: 'your-app-secret',
host: 'ws.relaycloud.dev',
port: '443',
useTLS: true,
});
Python (pusher)
import pusher
client = pusher.Pusher(
app_id='your-app-id',
key='your-app-key',
secret='your-app-secret',
host='ws.relaycloud.dev',
port=443,
ssl=True,
)
Ruby (pusher gem)
Pusher.app_id = 'your-app-id'
Pusher.key = 'your-app-key'
Pusher.secret = 'your-app-secret'
Pusher.host = 'ws.relaycloud.dev'
Pusher.port = 443
Pusher.scheme = 'https'
Go (pusher/pusher-http-go)
client := pusher.Client{
AppID: "your-app-id",
Key: "your-app-key",
Secret: "your-app-secret",
Host: "ws.relaycloud.dev:443",
Secure: true,
}
Java (pusher-http-java)
Pusher pusher = new Pusher("your-app-id", "your-app-key", "your-app-secret");
pusher.setHost("ws.relaycloud.dev");
pusher.setPort(443);
pusher.setEncrypted(true);
.NET (PusherServer NuGet)
var pusher = new Pusher(
"your-app-id",
"your-app-key",
"your-app-secret",
new PusherOptions {
Host = "ws.relaycloud.dev",
Encrypted = true
}
);
Swift (pusher-websocket-swift)
let options = PusherClientOptions(
authMethod: .inline(secret: "your-app-secret"),
host: .custom("ws.relaycloud.dev"),
port: 443,
useTLS: true
)
let pusher = Pusher(key: "your-app-key", options: options)
Kotlin / Android (pusher-websocket-android)
val options = PusherOptions().apply {
setHost("ws.relaycloud.dev")
setWssPort(443)
isEncrypted = true
}
val pusher = Pusher("your-app-key", options)
Self-Hosted
If you are self-hosting Relay, replace ws.relaycloud.dev with your server's hostname or IP address. Set the port to whatever port your Relay server listens on (default: 6001). Set scheme to http and useTLS to false if you are not using SSL.
# Self-hosted config
Host: your-server-ip-or-domain
Port: 6001
TLS: false (unless you have SSL configured)
Ready to skip the server setup? Relay Cloud gives you a production WebSocket server instantly. Start free, upgrade when you grow.
Start free →