@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.
package/dist/service-client.d.ts
CHANGED
|
@@ -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;
|
package/dist/service-client.js
CHANGED
|
@@ -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()}`,
|
package/dist/service-host.d.ts
CHANGED
|
@@ -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>;
|
package/dist/service-host.js
CHANGED
|
@@ -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)}`,
|
package/dist/webrtc-context.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Signaler } from './types';
|
|
2
2
|
export declare class WebRTCContext {
|
|
3
3
|
readonly signaler: Signaler;
|
|
4
|
-
|
|
4
|
+
private readonly config?;
|
|
5
|
+
constructor(signaler: Signaler, config?: RTCConfiguration | undefined);
|
|
5
6
|
createPeerConnection(): RTCPeerConnection;
|
|
6
7
|
}
|
package/dist/webrtc-context.js
CHANGED
|
@@ -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