@afosecure/meshsdk 0.1.1 → 0.1.2
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/LICENSE +21 -21
- package/README.md +373 -373
- package/dist/index.d.mts +283 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +1439 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1404 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -68
package/README.md
CHANGED
|
@@ -1,373 +1,373 @@
|
|
|
1
|
-
# 📹 MESHSDK
|
|
2
|
-
|
|
3
|
-
A lightweight React SDK for building peer-to-peer video conferencing applications using WebRTC Mesh networking. The SDK provides a modern React API, built-in meeting state management, screen sharing, chat, waiting room support, and flexible WebSocket signaling.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- Peer-to-peer WebRTC Mesh architecture
|
|
10
|
-
- HD audio and video
|
|
11
|
-
- Screen sharing
|
|
12
|
-
- Waiting room with host approval
|
|
13
|
-
- Public and private in-meeting chat
|
|
14
|
-
- Participant presence and media state
|
|
15
|
-
- Automatic ICE restart & reconnection
|
|
16
|
-
- STUN/TURN support
|
|
17
|
-
- React Hooks API
|
|
18
|
-
- Full TypeScript support
|
|
19
|
-
- Lightweight with zero UI dependencies
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install @afosecure/meshsdk
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
or
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pnpm add @afosecure/meetingsdk
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
or
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
yarn add @afosecure/meetingsdk
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
# Quick Start
|
|
44
|
-
|
|
45
|
-
## Create the SDK
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import { useState } from "react";
|
|
49
|
-
import { MeetingProvider, VideoSDKCore } from "@afosecure/meetingsdk";
|
|
50
|
-
|
|
51
|
-
export default function App() {
|
|
52
|
-
const [sdk] = useState(
|
|
53
|
-
() =>
|
|
54
|
-
new VideoSDKCore({
|
|
55
|
-
onUserJoined: console.log,
|
|
56
|
-
onUserLeft: console.log,
|
|
57
|
-
onTrack: console.log,
|
|
58
|
-
}),
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<MeetingProvider core={sdk}>
|
|
63
|
-
<Meeting />
|
|
64
|
-
</MeetingProvider>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Join a Meeting
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { useMeeting } from "@afosecure/meetingsdk";
|
|
75
|
-
|
|
76
|
-
export default function Meeting() {
|
|
77
|
-
const { joinMeeting, startLocalStream, leaveMeeting } = useMeeting();
|
|
78
|
-
|
|
79
|
-
const join = async () => {
|
|
80
|
-
await startLocalStream(videoRef.current!, "John");
|
|
81
|
-
|
|
82
|
-
await joinMeeting({
|
|
83
|
-
roomId: "room-123",
|
|
84
|
-
name: "John",
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<>
|
|
90
|
-
<button onClick={join}>Join</button>
|
|
91
|
-
|
|
92
|
-
<button onClick={leaveMeeting}>Leave</button>
|
|
93
|
-
</>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
# React Hooks
|
|
101
|
-
|
|
102
|
-
## useMeeting()
|
|
103
|
-
|
|
104
|
-
Provides meeting actions and local participant state.
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
const {
|
|
108
|
-
joinMeeting,
|
|
109
|
-
leaveMeeting,
|
|
110
|
-
toggleMic,
|
|
111
|
-
toggleCam,
|
|
112
|
-
startScreenShare,
|
|
113
|
-
stopScreenShare,
|
|
114
|
-
sendChatMessage,
|
|
115
|
-
participants,
|
|
116
|
-
localParticipant,
|
|
117
|
-
presenterId,
|
|
118
|
-
} = useMeeting();
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## useParticipants()
|
|
124
|
-
|
|
125
|
-
Returns all remote participants.
|
|
126
|
-
|
|
127
|
-
```ts
|
|
128
|
-
const participants = useParticipants();
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## useLocalParticipant()
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
const participant = useLocalParticipant();
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## useChat()
|
|
142
|
-
|
|
143
|
-
```ts
|
|
144
|
-
const { messages, sendChatMessage } = useChat();
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## useMeetingState()
|
|
150
|
-
|
|
151
|
-
Subscribe to the underlying reactive meeting state.
|
|
152
|
-
|
|
153
|
-
```ts
|
|
154
|
-
const meeting = useMeetingState();
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
# Meeting Events
|
|
160
|
-
|
|
161
|
-
```ts
|
|
162
|
-
const sdk = new VideoSDKCore({
|
|
163
|
-
onTrack(stream, participantId) {},
|
|
164
|
-
|
|
165
|
-
onUserJoined(participant) {},
|
|
166
|
-
|
|
167
|
-
onUserLeft(participantId) {},
|
|
168
|
-
|
|
169
|
-
onChatMessage(message) {},
|
|
170
|
-
|
|
171
|
-
onScreenShareStarted(id, stream) {},
|
|
172
|
-
|
|
173
|
-
onScreenShareStopped(id) {},
|
|
174
|
-
|
|
175
|
-
onMicToggled(id, enabled) {},
|
|
176
|
-
|
|
177
|
-
onCamToggled(id, enabled) {},
|
|
178
|
-
|
|
179
|
-
onMeetingLeft() {},
|
|
180
|
-
|
|
181
|
-
onError(error) {},
|
|
182
|
-
});
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
# Features
|
|
188
|
-
|
|
189
|
-
## Audio & Video
|
|
190
|
-
|
|
191
|
-
- Camera
|
|
192
|
-
- Microphone
|
|
193
|
-
- Mute / Unmute
|
|
194
|
-
- Camera On / Off
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Screen Sharing
|
|
199
|
-
|
|
200
|
-
```ts
|
|
201
|
-
await startScreenShare();
|
|
202
|
-
|
|
203
|
-
stopScreenShare();
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Supports:
|
|
207
|
-
|
|
208
|
-
- Presenter detection
|
|
209
|
-
- Automatic renegotiation
|
|
210
|
-
- Browser stop-share handling
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## Waiting Room
|
|
215
|
-
|
|
216
|
-
Supports:
|
|
217
|
-
|
|
218
|
-
- Join requests
|
|
219
|
-
- Host approval
|
|
220
|
-
- Host rejection
|
|
221
|
-
- Rejoin after approval
|
|
222
|
-
|
|
223
|
-
Events:
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
onEntryRequested();
|
|
227
|
-
|
|
228
|
-
onEntryResponded();
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Chat
|
|
234
|
-
|
|
235
|
-
Supports:
|
|
236
|
-
|
|
237
|
-
- Public messages
|
|
238
|
-
- Private messages
|
|
239
|
-
- Replies
|
|
240
|
-
- Optimistic updates
|
|
241
|
-
|
|
242
|
-
```ts
|
|
243
|
-
sendChatMessage({
|
|
244
|
-
message: "Hello everyone!",
|
|
245
|
-
});
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
# Architecture
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
Participant A
|
|
254
|
-
│
|
|
255
|
-
│
|
|
256
|
-
WebSocket
|
|
257
|
-
(Signaling Only)
|
|
258
|
-
│
|
|
259
|
-
Participant B
|
|
260
|
-
|
|
261
|
-
Media
|
|
262
|
-
──────────────►
|
|
263
|
-
Direct WebRTC
|
|
264
|
-
Peer Connection
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
Media never passes through the signaling server.
|
|
268
|
-
|
|
269
|
-
The WebSocket server is only responsible for:
|
|
270
|
-
|
|
271
|
-
- room management
|
|
272
|
-
- participant discovery
|
|
273
|
-
- signaling
|
|
274
|
-
- waiting room
|
|
275
|
-
- ICE exchange
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
# Server Requirements
|
|
280
|
-
|
|
281
|
-
Your signaling server should support the following messages.
|
|
282
|
-
|
|
283
|
-
## Client → Server
|
|
284
|
-
|
|
285
|
-
- JOIN
|
|
286
|
-
- LEAVE
|
|
287
|
-
- OFFER
|
|
288
|
-
- ANSWER
|
|
289
|
-
- ICE
|
|
290
|
-
- CHAT_MESSAGE
|
|
291
|
-
- MEDIA_STATE
|
|
292
|
-
- SCREEN_SHARE_START
|
|
293
|
-
- SCREEN_SHARE_STOP
|
|
294
|
-
- JOIN_APPROVE
|
|
295
|
-
- JOIN_REJECT
|
|
296
|
-
- PING
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
|
-
## Server → Client
|
|
301
|
-
|
|
302
|
-
- JOINED
|
|
303
|
-
- EXISTING_USERS
|
|
304
|
-
- USER_JOINED
|
|
305
|
-
- USER_LEFT
|
|
306
|
-
- OFFER
|
|
307
|
-
- ANSWER
|
|
308
|
-
- ICE
|
|
309
|
-
- CHAT_MESSAGE
|
|
310
|
-
- MEDIA_STATE_CHANGE
|
|
311
|
-
- SCREEN_SHARE_START
|
|
312
|
-
- SCREEN_SHARE_STOP
|
|
313
|
-
- JOIN_PENDING
|
|
314
|
-
- JOIN_APPROVED
|
|
315
|
-
- JOIN_REJECTED
|
|
316
|
-
- ERROR
|
|
317
|
-
- PONG
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
# STUN & TURN
|
|
322
|
-
|
|
323
|
-
The SDK expects the signaling server to provide ICE servers during the JOIN flow.
|
|
324
|
-
|
|
325
|
-
Example:
|
|
326
|
-
|
|
327
|
-
```json
|
|
328
|
-
{
|
|
329
|
-
"iceServers": [
|
|
330
|
-
{
|
|
331
|
-
"urls": ["stun:stun.l.google.com:19302"]
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"urls": ["turn:turn.example.com:3478"],
|
|
335
|
-
"username": "...",
|
|
336
|
-
"credential": "..."
|
|
337
|
-
}
|
|
338
|
-
]
|
|
339
|
-
}
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
# Browser Support
|
|
345
|
-
|
|
346
|
-
- Chrome
|
|
347
|
-
- Edge
|
|
348
|
-
- Firefox
|
|
349
|
-
- Safari
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
# Mesh Networking
|
|
354
|
-
|
|
355
|
-
This SDK uses a Mesh topology.
|
|
356
|
-
|
|
357
|
-
Every participant establishes a direct WebRTC connection with every other participant.
|
|
358
|
-
|
|
359
|
-
Best suited for:
|
|
360
|
-
|
|
361
|
-
- One-to-one calls
|
|
362
|
-
- Interviews
|
|
363
|
-
- Online consultations
|
|
364
|
-
- Small meetings
|
|
365
|
-
- Team discussions
|
|
366
|
-
|
|
367
|
-
For larger meetings (10+ participants), an SFU architecture is recommended.
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
# License
|
|
372
|
-
|
|
373
|
-
MIT
|
|
1
|
+
# 📹 MESHSDK
|
|
2
|
+
|
|
3
|
+
A lightweight React SDK for building peer-to-peer video conferencing applications using WebRTC Mesh networking. The SDK provides a modern React API, built-in meeting state management, screen sharing, chat, waiting room support, and flexible WebSocket signaling.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Peer-to-peer WebRTC Mesh architecture
|
|
10
|
+
- HD audio and video
|
|
11
|
+
- Screen sharing
|
|
12
|
+
- Waiting room with host approval
|
|
13
|
+
- Public and private in-meeting chat
|
|
14
|
+
- Participant presence and media state
|
|
15
|
+
- Automatic ICE restart & reconnection
|
|
16
|
+
- STUN/TURN support
|
|
17
|
+
- React Hooks API
|
|
18
|
+
- Full TypeScript support
|
|
19
|
+
- Lightweight with zero UI dependencies
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @afosecure/meshsdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
or
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add @afosecure/meetingsdk
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
or
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn add @afosecure/meetingsdk
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Quick Start
|
|
44
|
+
|
|
45
|
+
## Create the SDK
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { useState } from "react";
|
|
49
|
+
import { MeetingProvider, VideoSDKCore } from "@afosecure/meetingsdk";
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
const [sdk] = useState(
|
|
53
|
+
() =>
|
|
54
|
+
new VideoSDKCore({
|
|
55
|
+
onUserJoined: console.log,
|
|
56
|
+
onUserLeft: console.log,
|
|
57
|
+
onTrack: console.log,
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<MeetingProvider core={sdk}>
|
|
63
|
+
<Meeting />
|
|
64
|
+
</MeetingProvider>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Join a Meeting
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { useMeeting } from "@afosecure/meetingsdk";
|
|
75
|
+
|
|
76
|
+
export default function Meeting() {
|
|
77
|
+
const { joinMeeting, startLocalStream, leaveMeeting } = useMeeting();
|
|
78
|
+
|
|
79
|
+
const join = async () => {
|
|
80
|
+
await startLocalStream(videoRef.current!, "John");
|
|
81
|
+
|
|
82
|
+
await joinMeeting({
|
|
83
|
+
roomId: "room-123",
|
|
84
|
+
name: "John",
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<button onClick={join}>Join</button>
|
|
91
|
+
|
|
92
|
+
<button onClick={leaveMeeting}>Leave</button>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# React Hooks
|
|
101
|
+
|
|
102
|
+
## useMeeting()
|
|
103
|
+
|
|
104
|
+
Provides meeting actions and local participant state.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const {
|
|
108
|
+
joinMeeting,
|
|
109
|
+
leaveMeeting,
|
|
110
|
+
toggleMic,
|
|
111
|
+
toggleCam,
|
|
112
|
+
startScreenShare,
|
|
113
|
+
stopScreenShare,
|
|
114
|
+
sendChatMessage,
|
|
115
|
+
participants,
|
|
116
|
+
localParticipant,
|
|
117
|
+
presenterId,
|
|
118
|
+
} = useMeeting();
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## useParticipants()
|
|
124
|
+
|
|
125
|
+
Returns all remote participants.
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
const participants = useParticipants();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## useLocalParticipant()
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const participant = useLocalParticipant();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## useChat()
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
const { messages, sendChatMessage } = useChat();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## useMeetingState()
|
|
150
|
+
|
|
151
|
+
Subscribe to the underlying reactive meeting state.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
const meeting = useMeetingState();
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
# Meeting Events
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
const sdk = new VideoSDKCore({
|
|
163
|
+
onTrack(stream, participantId) {},
|
|
164
|
+
|
|
165
|
+
onUserJoined(participant) {},
|
|
166
|
+
|
|
167
|
+
onUserLeft(participantId) {},
|
|
168
|
+
|
|
169
|
+
onChatMessage(message) {},
|
|
170
|
+
|
|
171
|
+
onScreenShareStarted(id, stream) {},
|
|
172
|
+
|
|
173
|
+
onScreenShareStopped(id) {},
|
|
174
|
+
|
|
175
|
+
onMicToggled(id, enabled) {},
|
|
176
|
+
|
|
177
|
+
onCamToggled(id, enabled) {},
|
|
178
|
+
|
|
179
|
+
onMeetingLeft() {},
|
|
180
|
+
|
|
181
|
+
onError(error) {},
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
# Features
|
|
188
|
+
|
|
189
|
+
## Audio & Video
|
|
190
|
+
|
|
191
|
+
- Camera
|
|
192
|
+
- Microphone
|
|
193
|
+
- Mute / Unmute
|
|
194
|
+
- Camera On / Off
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Screen Sharing
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
await startScreenShare();
|
|
202
|
+
|
|
203
|
+
stopScreenShare();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Supports:
|
|
207
|
+
|
|
208
|
+
- Presenter detection
|
|
209
|
+
- Automatic renegotiation
|
|
210
|
+
- Browser stop-share handling
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Waiting Room
|
|
215
|
+
|
|
216
|
+
Supports:
|
|
217
|
+
|
|
218
|
+
- Join requests
|
|
219
|
+
- Host approval
|
|
220
|
+
- Host rejection
|
|
221
|
+
- Rejoin after approval
|
|
222
|
+
|
|
223
|
+
Events:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
onEntryRequested();
|
|
227
|
+
|
|
228
|
+
onEntryResponded();
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Chat
|
|
234
|
+
|
|
235
|
+
Supports:
|
|
236
|
+
|
|
237
|
+
- Public messages
|
|
238
|
+
- Private messages
|
|
239
|
+
- Replies
|
|
240
|
+
- Optimistic updates
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
sendChatMessage({
|
|
244
|
+
message: "Hello everyone!",
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
# Architecture
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
Participant A
|
|
254
|
+
│
|
|
255
|
+
│
|
|
256
|
+
WebSocket
|
|
257
|
+
(Signaling Only)
|
|
258
|
+
│
|
|
259
|
+
Participant B
|
|
260
|
+
|
|
261
|
+
Media
|
|
262
|
+
──────────────►
|
|
263
|
+
Direct WebRTC
|
|
264
|
+
Peer Connection
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Media never passes through the signaling server.
|
|
268
|
+
|
|
269
|
+
The WebSocket server is only responsible for:
|
|
270
|
+
|
|
271
|
+
- room management
|
|
272
|
+
- participant discovery
|
|
273
|
+
- signaling
|
|
274
|
+
- waiting room
|
|
275
|
+
- ICE exchange
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
# Server Requirements
|
|
280
|
+
|
|
281
|
+
Your signaling server should support the following messages.
|
|
282
|
+
|
|
283
|
+
## Client → Server
|
|
284
|
+
|
|
285
|
+
- JOIN
|
|
286
|
+
- LEAVE
|
|
287
|
+
- OFFER
|
|
288
|
+
- ANSWER
|
|
289
|
+
- ICE
|
|
290
|
+
- CHAT_MESSAGE
|
|
291
|
+
- MEDIA_STATE
|
|
292
|
+
- SCREEN_SHARE_START
|
|
293
|
+
- SCREEN_SHARE_STOP
|
|
294
|
+
- JOIN_APPROVE
|
|
295
|
+
- JOIN_REJECT
|
|
296
|
+
- PING
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Server → Client
|
|
301
|
+
|
|
302
|
+
- JOINED
|
|
303
|
+
- EXISTING_USERS
|
|
304
|
+
- USER_JOINED
|
|
305
|
+
- USER_LEFT
|
|
306
|
+
- OFFER
|
|
307
|
+
- ANSWER
|
|
308
|
+
- ICE
|
|
309
|
+
- CHAT_MESSAGE
|
|
310
|
+
- MEDIA_STATE_CHANGE
|
|
311
|
+
- SCREEN_SHARE_START
|
|
312
|
+
- SCREEN_SHARE_STOP
|
|
313
|
+
- JOIN_PENDING
|
|
314
|
+
- JOIN_APPROVED
|
|
315
|
+
- JOIN_REJECTED
|
|
316
|
+
- ERROR
|
|
317
|
+
- PONG
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
# STUN & TURN
|
|
322
|
+
|
|
323
|
+
The SDK expects the signaling server to provide ICE servers during the JOIN flow.
|
|
324
|
+
|
|
325
|
+
Example:
|
|
326
|
+
|
|
327
|
+
```json
|
|
328
|
+
{
|
|
329
|
+
"iceServers": [
|
|
330
|
+
{
|
|
331
|
+
"urls": ["stun:stun.l.google.com:19302"]
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"urls": ["turn:turn.example.com:3478"],
|
|
335
|
+
"username": "...",
|
|
336
|
+
"credential": "..."
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
# Browser Support
|
|
345
|
+
|
|
346
|
+
- Chrome
|
|
347
|
+
- Edge
|
|
348
|
+
- Firefox
|
|
349
|
+
- Safari
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
# Mesh Networking
|
|
354
|
+
|
|
355
|
+
This SDK uses a Mesh topology.
|
|
356
|
+
|
|
357
|
+
Every participant establishes a direct WebRTC connection with every other participant.
|
|
358
|
+
|
|
359
|
+
Best suited for:
|
|
360
|
+
|
|
361
|
+
- One-to-one calls
|
|
362
|
+
- Interviews
|
|
363
|
+
- Online consultations
|
|
364
|
+
- Small meetings
|
|
365
|
+
- Team discussions
|
|
366
|
+
|
|
367
|
+
For larger meetings (10+ participants), an SFU architecture is recommended.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
# License
|
|
372
|
+
|
|
373
|
+
MIT
|