@xtr-dev/rondevu-client 0.10.0 → 0.10.1

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.
@@ -9,6 +9,7 @@ export interface ServiceClientOptions {
9
9
  autoReconnect?: boolean;
10
10
  reconnectDelay?: number;
11
11
  maxReconnectAttempts?: number;
12
+ rtcConfiguration?: RTCConfiguration;
12
13
  }
13
14
  export interface ServiceClientEvents {
14
15
  connected: ConnectionInterface;
@@ -58,6 +59,7 @@ export declare class ServiceClient {
58
59
  private readonly autoReconnect;
59
60
  private readonly reconnectDelay;
60
61
  private readonly maxReconnectAttempts;
62
+ private readonly rtcConfiguration?;
61
63
  private connection;
62
64
  private reconnectAttempts;
63
65
  private reconnectTimeout;
@@ -47,6 +47,7 @@ export class ServiceClient {
47
47
  this.autoReconnect = options.autoReconnect !== false;
48
48
  this.reconnectDelay = options.reconnectDelay || 2000;
49
49
  this.maxReconnectAttempts = options.maxReconnectAttempts || 5;
50
+ this.rtcConfiguration = options.rtcConfiguration;
50
51
  }
51
52
  /**
52
53
  * Connect to the service
@@ -73,7 +74,7 @@ export class ServiceClient {
73
74
  const serviceDetails = await this.rondevuService.getAPI().getService(service.uuid);
74
75
  // Create WebRTC context with signaler for this offer
75
76
  const signaler = new RondevuSignaler(this.rondevuService.getAPI(), serviceDetails.offerId);
76
- const context = new WebRTCContext(signaler);
77
+ const context = new WebRTCContext(signaler, this.rtcConfiguration);
77
78
  // Create connection (answerer role)
78
79
  const conn = new WebRTCRondevuConnection({
79
80
  id: `client-${this.serviceFqn}-${Date.now()}`,
@@ -9,6 +9,7 @@ export interface ServiceHostOptions {
9
9
  ttl?: number;
10
10
  isPublic?: boolean;
11
11
  metadata?: Record<string, any>;
12
+ rtcConfiguration?: RTCConfiguration;
12
13
  }
13
14
  export interface ServiceHostEvents {
14
15
  connection: ConnectionInterface;
@@ -58,6 +59,7 @@ export declare class ServiceHost {
58
59
  private readonly ttl;
59
60
  private readonly isPublic;
60
61
  private readonly metadata?;
62
+ private readonly rtcConfiguration?;
61
63
  private readonly bin;
62
64
  private isStarted;
63
65
  readonly events: EventBus<ServiceHostEvents>;
@@ -48,6 +48,7 @@ export class ServiceHost {
48
48
  this.ttl = options.ttl || 300000;
49
49
  this.isPublic = options.isPublic !== false;
50
50
  this.metadata = options.metadata;
51
+ this.rtcConfiguration = options.rtcConfiguration;
51
52
  }
52
53
  /**
53
54
  * Start hosting the service - creates initial pool of offers
@@ -104,7 +105,7 @@ export class ServiceHost {
104
105
  async createOffer() {
105
106
  try {
106
107
  // Create temporary context with NoOp signaler
107
- const tempContext = new WebRTCContext(new NoOpSignaler());
108
+ const tempContext = new WebRTCContext(new NoOpSignaler(), this.rtcConfiguration);
108
109
  // Create connection (offerer role)
109
110
  const conn = new WebRTCRondevuConnection({
110
111
  id: `${this.service}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
@@ -1,6 +1,7 @@
1
1
  import { Signaler } from './types';
2
2
  export declare class WebRTCContext {
3
3
  readonly signaler: Signaler;
4
- constructor(signaler: Signaler);
4
+ private readonly config?;
5
+ constructor(signaler: Signaler, config?: RTCConfiguration | undefined);
5
6
  createPeerConnection(): RTCPeerConnection;
6
7
  }
@@ -1,34 +1,36 @@
1
+ const DEFAULT_RTC_CONFIGURATION = {
2
+ iceServers: [
3
+ {
4
+ urls: 'stun:stun.relay.metered.ca:80',
5
+ },
6
+ {
7
+ urls: 'turn:standard.relay.metered.ca:80',
8
+ username: 'c53a9c971da5e6f3bc959d8d',
9
+ credential: 'QaccPqtPPaxyokXp',
10
+ },
11
+ {
12
+ urls: 'turn:standard.relay.metered.ca:80?transport=tcp',
13
+ username: 'c53a9c971da5e6f3bc959d8d',
14
+ credential: 'QaccPqtPPaxyokXp',
15
+ },
16
+ {
17
+ urls: 'turn:standard.relay.metered.ca:443',
18
+ username: 'c53a9c971da5e6f3bc959d8d',
19
+ credential: 'QaccPqtPPaxyokXp',
20
+ },
21
+ {
22
+ urls: 'turns:standard.relay.metered.ca:443?transport=tcp',
23
+ username: 'c53a9c971da5e6f3bc959d8d',
24
+ credential: 'QaccPqtPPaxyokXp',
25
+ },
26
+ ],
27
+ };
1
28
  export class WebRTCContext {
2
- constructor(signaler) {
29
+ constructor(signaler, config) {
3
30
  this.signaler = signaler;
31
+ this.config = config;
4
32
  }
5
33
  createPeerConnection() {
6
- return new RTCPeerConnection({
7
- iceServers: [
8
- {
9
- urls: 'stun:stun.relay.metered.ca:80',
10
- },
11
- {
12
- urls: 'turn:standard.relay.metered.ca:80',
13
- username: 'c53a9c971da5e6f3bc959d8d',
14
- credential: 'QaccPqtPPaxyokXp',
15
- },
16
- {
17
- urls: 'turn:standard.relay.metered.ca:80?transport=tcp',
18
- username: 'c53a9c971da5e6f3bc959d8d',
19
- credential: 'QaccPqtPPaxyokXp',
20
- },
21
- {
22
- urls: 'turn:standard.relay.metered.ca:443',
23
- username: 'c53a9c971da5e6f3bc959d8d',
24
- credential: 'QaccPqtPPaxyokXp',
25
- },
26
- {
27
- urls: 'turns:standard.relay.metered.ca:443?transport=tcp',
28
- username: 'c53a9c971da5e6f3bc959d8d',
29
- credential: 'QaccPqtPPaxyokXp',
30
- },
31
- ],
32
- });
34
+ return new RTCPeerConnection(this.config || DEFAULT_RTC_CONFIGURATION);
33
35
  }
34
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/rondevu-client",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "TypeScript client for Rondevu with durable WebRTC connections, automatic reconnection, and message queuing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",