-
Notifications
You must be signed in to change notification settings - Fork 155
0.25.0 #177
-
Improvements
- Actions have a new object-based API with request/response support.
makeAction()now returns an action object withsend(),onMessage/onRequest,request(),requestMany(), and progress hooks depending on the action kind. Thanks to @Abdullah-Azbah for writing the initial request/response proposal. - Added
passiveroom mode for backup peers. Passive rooms stay dormant until they hear an active peer, avoid connecting to other passive peers, and deactivate again when active work is done. This should make standby/server-side peers much cheaper to keep around. You can use these peers for syncing persisted data. Thanks to @tionis for adding this. onJoinErrorwill now report cases where peers exchange SDP but cannot establish a WebRTC connection, which usually means TURN servers are needed or misconfigured.- Media APIs now use options objects, matching the new action API shape. This makes targeted sends and metadata clearer across streams, tracks, and replacements.
- Added
createTopicStrategy()that makes writing custom pub/sub signaling strategies even simpler.createStrategy()is still available as the lower-level API for protocols that need more control. - Nostr subscriptions are now batched, and Torrent passive rooms announce less aggressively while dormant.
⚠️ Breaking changes
room.makeAction() no longer returns [send, receive, progress]. It now returns an action object:
const drink = room.makeAction('drink') drink.send({drink: 'negroni'}, {target: peerId}) drink.onMessage = (data, {peerId}) => { console.log('got drink from', peerId, data) }
Request/response actions can be created with kind: 'request':
const isEven = room.makeAction('isEven', { kind: 'request', onRequest: n => n % 2 === 0 }) const result = await isEven.request(42, { target: peerId, timeoutMs: 1000 })
Room event handlers are now nullable callback properties instead of registration functions:
room.onPeerJoin = peerId => console.log(`${peerId} joined`) room.onPeerLeave = peerId => console.log(`${peerId} left`) room.onPeerStream = (stream, peerId, metadata) => {} room.onPeerTrack = (track, stream, peerId, metadata) => {}
Media targeting and metadata now use options objects:
room.addStream(stream, { target: peerId, metadata: {kind: 'screen'} })
The same shape applies to removeStream(), addTrack(), removeTrack(), and replaceTrack().
This will require existing codebases to migrate syntax when upgrading to 0.25.0.
This discussion was created from the release 0.25.0.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Congrats on the huge release @dmotz! FYI I've updated Chitchatter to use 0.25.0, in case anyone is looking for prior art for a migration: jeremyckahn/chitchatter@e591b5f
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 1 -
❤️ 1