Supabase Driver
The Supabase Driver is a signaling driver that uses Supabase Realtime to relay signaling messages between peers through your own Supabase project. It is a good choice when you want browser and device communication over infrastructure you already manage.
Unlike the Memory Driver or BroadcastChannel Driver, the Supabase Driver works across browsers, devices, and networks because signaling messages pass through Supabase instead of staying inside a single browser context. That makes it useful for production deployments where peers need to discover each other outside the local page.
Usage
To use the Supabase Driver, import the driver from Peerix, create a Supabase client, and pass that client to the driver instance:
import { SupabaseDriver } from 'peerix';
import { createClient } from '@supabase/supabase-js';
// connect to your Supabase project
const supabase = createClient('your_project_url', 'your_supabase_api_key');
// create the Supabase driver instance
const driver = new SupabaseDriver({
// the Supabase client instance
supabase,
// prefix for signaling channels
prefix: 'peerix',
});All peers that connect to the same Supabase project and use the same prefix can discover each other and exchange signaling messages.
Installation
You need the @supabase/supabase-js package in the browser to use the Supabase Driver.
npm install @supabase/supabase-js