Pusher To PieSocket
Migrate from Pusher
PieSocket is fully compatible with Pusher client and server SDKs.
Client-side
Replace Pusher app-key with your PieSocket api key and add wsHost, enabledTransports configuration options into your Pusher initialization.
var pusher = new Pusher("[PIESOCKET_API_KEY]", {
wsHost: '[PIESOCKET_CLUSER_ID].piesocket.com',
enabledTransports: ['ws', 'wss'],
cluster: "piesocket"
});
var channel = pusher.subscribe("my-channel");
That's it.
No code changes required.
Server-side
Server-side configuration is similar. Repalce app_id, app_key and app_secret with PieSocket's api_id, api_key and api_secret.
Now change the host configuration option to point to PieSocket's cluster.
$app_id = 'PIESOCKET_API_ID';
$app_key = 'PIESOCKET_API_KEY';
$app_secret = 'PIESOCKET_API_SECRET';
$app_cluster = 'piesocket';
$pusher = new PusherPusher(
$app_key,
$app_secret,
$app_id,
[
'host' => '[PIESOCKET_CLUSER_ID].piesocket.com',
'cluster' => $app_cluster
]
);
$pusher->trigger('my-channel', 'my-event', 'hello world'));
That's it.
Happy cost savings!
On this page
