Peerix v0.2 Released
Peerix v0.2 is now available. This release expands signaling options, simplifies interoperability, and improves default privacy behavior in production environments.
Highlights
New signaling drivers
Peerix now includes two new built-in signaling drivers:
SocketIoDriverfor applications using Socket.IO infrastructure.SupabaseDriverfor projects built on Supabase Realtime.
These drivers make it easier to integrate Peerix into existing stacks without adding custom signaling glue code.
In v0.2, both drivers follow the same setup pattern used by other Peerix signaling drivers: create your transport client, pass it to the driver, then initialize Peer with that driver. This makes it simple to switch transports without changing application-level peer logic.
Socket.IO driver
Socket.IO is a popular real-time communication library that provides a WebSocket-like API with fallbacks for older browsers. The SocketIoDriver allows you to use Socket.IO as the signaling transport for Peerix, enabling seamless integration with existing Socket.IO servers.
import { Peer, SocketIoDriver } from 'peerix';
import { io } from 'socket.io-client';
const socket = io('https://your-socket-server.example.com');
const driver = new SocketIoDriver({
socket,
prefix: 'peerix',
});
const peer = new Peer({ driver });
await peer.join({ room: 'my-room' });Note that you will need a compatible server-side Socket.IO implementation to use this driver. See the Socket.IO Driver docs for a code example.
Supabase driver
Supabase Realtime is a serverless real-time database and messaging service built on PostgreSQL. The SupabaseDriver allows you to use Supabase Realtime as the signaling transport for Peerix, making it easy to integrate with applications already using Supabase.
import { Peer, SupabaseDriver } from 'peerix';
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
'https://your-project.supabase.co',
'public-anon-key',
);
const driver = new SupabaseDriver({
supabase,
prefix: 'peerix',
});
const peer = new Peer({ driver });
await peer.join({ room: 'my-room' });Note that you will need to set up a Supabase Realtime subscription on the server side to use this driver.
NATS driver update
The NatsDriver now uses nats-core instead of nats.ws because of deprecation. This change improves consistency and aligns Peerix with the current direction of the NATS JavaScript ecosystem.
NATS (nats-core) example
import { Peer, NatsDriver } from 'peerix';
import { wsconnect } from '@nats-io/nats-core';
const nc = await wsconnect({ servers: ['wss://demo.nats.io:8443'] });
const driver = new NatsDriver({
nc,
prefix: 'peerix',
});
const peer = new Peer({ driver });
await peer.join({ room: 'my-room' });See NATS Driver docs for full details and migration guidance.
Driver cleanup with destroy
When your app unmounts a page, leaves a workspace, or otherwise tears down realtime state, explicitly destroy the driver to avoid dangling subscriptions or listeners:
await peer.leave();
await driver.destroy();Serialization-friendly driver interface
The driver interface now favors plain arrays over typed arrays. This improves serialization across environments and transports, especially when messages cross boundaries where typed arrays can be awkward or lossy.
Namespace hashing enabled by default
Namespace hashing is now enabled by default. This delivers two practical benefits:
- Better privacy by avoiding direct exposure of raw namespace values.
- Better compatibility by preventing issues with unsupported namespace characters.
Upgrade notes
When moving to v0.2, review the following:
- If you rely on readable namespace values in infrastructure logs or tooling, account for hashing now being enabled by default.
- If your custom drivers depend on typed array assumptions, update them to work with plain arrays.
- If you use NATS signaling, verify your setup against the
nats-coredependency.
Thank you
Thanks to everyone trying Peerix early and sharing feedback. Your input helps shape the roadmap and improve real-world reliability.
More updates are coming soon, including continued work on drivers and developer experience.
