@xtr-dev/rondevu-client 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/rondevu.d.ts +5 -5
- package/dist/rondevu.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,11 +39,11 @@ const rdv = new Rondevu({
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
// Create
|
|
43
|
-
const connection = await rdv.
|
|
42
|
+
// Create an offer with custom ID
|
|
43
|
+
const connection = await rdv.offer('my-room-123');
|
|
44
44
|
|
|
45
|
-
// Or
|
|
46
|
-
const connection = await rdv.
|
|
45
|
+
// Or answer an existing offer
|
|
46
|
+
const connection = await rdv.answer('my-room-123');
|
|
47
47
|
|
|
48
48
|
// Use data channels
|
|
49
49
|
connection.on('connect', () => {
|
|
@@ -77,7 +77,7 @@ const rdv = new Rondevu({
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
const connection = await rdv.
|
|
80
|
+
const connection = await rdv.offer('my-room-123');
|
|
81
81
|
|
|
82
82
|
connection.on('connect', () => {
|
|
83
83
|
const channel = connection.dataChannel('chat');
|
|
@@ -88,8 +88,8 @@ connection.on('connect', () => {
|
|
|
88
88
|
### API
|
|
89
89
|
|
|
90
90
|
**Main Methods:**
|
|
91
|
-
- `rdv.
|
|
92
|
-
- `rdv.
|
|
91
|
+
- `rdv.offer(id)` - Create an offer with custom ID
|
|
92
|
+
- `rdv.answer(id)` - Answer an existing offer by ID
|
|
93
93
|
|
|
94
94
|
**Connection Events:**
|
|
95
95
|
- `connect` - Connection established
|
package/dist/rondevu.d.ts
CHANGED
|
@@ -38,17 +38,17 @@ export declare class Rondevu {
|
|
|
38
38
|
*/
|
|
39
39
|
updatePeerId(newPeerId: string): void;
|
|
40
40
|
/**
|
|
41
|
-
* Create
|
|
42
|
-
* @param id -
|
|
41
|
+
* Create an offer (offerer role)
|
|
42
|
+
* @param id - Offer identifier (custom code)
|
|
43
43
|
* @returns Promise that resolves to RondevuConnection
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
offer(id: string): Promise<RondevuConnection>;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Answer an existing offer by ID (answerer role)
|
|
48
48
|
* @param id - Offer code
|
|
49
49
|
* @returns Promise that resolves to RondevuConnection
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
answer(id: string): Promise<RondevuConnection>;
|
|
52
52
|
/**
|
|
53
53
|
* Wait for ICE gathering to complete
|
|
54
54
|
*/
|
package/dist/rondevu.js
CHANGED
|
@@ -40,7 +40,7 @@ export class Rondevu {
|
|
|
40
40
|
async checkServerVersion() {
|
|
41
41
|
try {
|
|
42
42
|
const { version: serverVersion } = await this.api.health();
|
|
43
|
-
const clientVersion = '0.3.
|
|
43
|
+
const clientVersion = '0.3.3'; // Should match package.json
|
|
44
44
|
if (!this.isVersionCompatible(clientVersion, serverVersion)) {
|
|
45
45
|
console.warn(`[Rondevu] Version mismatch: client v${clientVersion}, server v${serverVersion}. ` +
|
|
46
46
|
'This may cause compatibility issues.');
|
|
@@ -74,11 +74,11 @@ export class Rondevu {
|
|
|
74
74
|
this.peerId = newPeerId;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Create
|
|
78
|
-
* @param id -
|
|
77
|
+
* Create an offer (offerer role)
|
|
78
|
+
* @param id - Offer identifier (custom code)
|
|
79
79
|
* @returns Promise that resolves to RondevuConnection
|
|
80
80
|
*/
|
|
81
|
-
async
|
|
81
|
+
async offer(id) {
|
|
82
82
|
// Create peer connection
|
|
83
83
|
const pc = new this.RTCPeerConnection(this.rtcConfig);
|
|
84
84
|
// Create initial data channel for negotiation (required for offer creation)
|
|
@@ -111,11 +111,11 @@ export class Rondevu {
|
|
|
111
111
|
return connection;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Answer an existing offer by ID (answerer role)
|
|
115
115
|
* @param id - Offer code
|
|
116
116
|
* @returns Promise that resolves to RondevuConnection
|
|
117
117
|
*/
|
|
118
|
-
async
|
|
118
|
+
async answer(id) {
|
|
119
119
|
// Poll server to get offer by ID
|
|
120
120
|
const offerData = await this.findOfferById(id);
|
|
121
121
|
if (!offerData) {
|