diff --git a/README.md b/README.md index d8c95b2..0f3f98e 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ const rdv = new Rondevu({ } }); -// Create a connection with custom ID -const connection = await rdv.create('my-room-123'); +// Create an offer with custom ID +const connection = await rdv.offer('my-room-123'); -// Or connect to an existing connection -const connection = await rdv.connect('my-room-123'); +// Or answer an existing offer +const connection = await rdv.answer('my-room-123'); // Use data channels connection.on('connect', () => { @@ -77,7 +77,7 @@ const rdv = new Rondevu({ } }); -const connection = await rdv.create('my-room-123'); +const connection = await rdv.offer('my-room-123'); connection.on('connect', () => { const channel = connection.dataChannel('chat'); @@ -88,8 +88,8 @@ connection.on('connect', () => { ### API **Main Methods:** -- `rdv.create(id)` - Create connection with custom ID -- `rdv.connect(id)` - Connect to existing connection by ID +- `rdv.offer(id)` - Create an offer with custom ID +- `rdv.answer(id)` - Answer an existing offer by ID **Connection Events:** - `connect` - Connection established diff --git a/package.json b/package.json index fa3982e..80a9f92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xtr-dev/rondevu-client", - "version": "0.3.2", + "version": "0.3.3", "description": "TypeScript client for Rondevu peer signaling and discovery server", "type": "module", "main": "dist/index.js", diff --git a/src/rondevu.ts b/src/rondevu.ts index c244364..89c453f 100644 --- a/src/rondevu.ts +++ b/src/rondevu.ts @@ -62,7 +62,7 @@ export class Rondevu { private async checkServerVersion(): Promise { try { const { version: serverVersion } = await this.api.health(); - const clientVersion = '0.3.2'; // Should match package.json + const clientVersion = '0.3.3'; // Should match package.json if (!this.isVersionCompatible(clientVersion, serverVersion)) { console.warn( @@ -103,11 +103,11 @@ export class Rondevu { } /** - * Create a new connection (offerer role) - * @param id - Connection identifier (custom code) + * Create an offer (offerer role) + * @param id - Offer identifier (custom code) * @returns Promise that resolves to RondevuConnection */ - async create(id: string): Promise { + async offer(id: string): Promise { // Create peer connection const pc = new this.RTCPeerConnection(this.rtcConfig); @@ -149,11 +149,11 @@ export class Rondevu { } /** - * Connect to an existing offer by ID (answerer role) + * Answer an existing offer by ID (answerer role) * @param id - Offer code * @returns Promise that resolves to RondevuConnection */ - async connect(id: string): Promise { + async answer(id: string): Promise { // Poll server to get offer by ID const offerData = await this.findOfferById(id);