Centrifuge Driver
The Centrifuge Driver is a signaling driver that uses Centrifugo as the real-time transport layer between peers. It is a good choice when you want reliable pub/sub signaling with reconnect support, and when you need a production-ready server designed for high fan-out messaging.
Peerix uses this driver to exchange signaling messages via channels on your Centrifugo backend. Peers that connect to the same Centrifugo deployment and join the same namespaces can discover each other and establish direct peer-to-peer connections.
Usage
To use the Centrifuge Driver, import the driver from Peerix, create a Centrifuge client, connect it to your server, and then pass that client instance to the driver.
import { CentrifugeDriver } from 'peerix';
import { Centrifuge } from 'centrifuge';
// connect to a Centrifuge server
const centrifuge = new Centrifuge('ws://localhost:8000/connection/websocket');
centrifuge.connect();
// create a Centrifuge driver instance
const driver = new CentrifugeDriver({ centrifuge });In this setup, the Centrifuge client handles transport-level concerns (connection lifecycle, reconnects, subscriptions), while the Peerix driver handles signaling semantics.
You need to have a Centrifugo server running and properly configured to use this driver. See the self-hosting guide for more information.
Installation
Install the centrifuge browser client package in your project.
npm install centrifuge