mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-15 05:13:23 +00:00
Address code review suggestions
- Update README.md example to match new OfferFactory signature - Add error handling and RTCPeerConnection cleanup on factory failure - Document setupIceCandidateHandler() method usage - Use undefined instead of null for offerId variable Co-authored-by: Bas <bvdaakster@users.noreply.github.com>
This commit is contained in:
@@ -49,8 +49,8 @@ const rondevu = await Rondevu.connect({
|
||||
await rondevu.publishService({
|
||||
service: 'chat:1.0.0',
|
||||
maxOffers: 5, // Maintain up to 5 concurrent offers
|
||||
offerFactory: async (rtcConfig) => {
|
||||
const pc = new RTCPeerConnection(rtcConfig)
|
||||
offerFactory: async (pc) => {
|
||||
// pc is created by Rondevu with ICE handlers already attached
|
||||
const dc = pc.createDataChannel('chat')
|
||||
|
||||
dc.addEventListener('open', () => {
|
||||
@@ -64,7 +64,7 @@ await rondevu.publishService({
|
||||
|
||||
const offer = await pc.createOffer()
|
||||
await pc.setLocalDescription(offer)
|
||||
return { pc, dc, offer }
|
||||
return { dc, offer }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user