https://github.com/lesomnus/vanguard
Signaling with data channel
https://github.com/lesomnus/vanguard
datachannel signaling webrtc
Last synced: 3 months ago
JSON representation
Signaling with data channel
- Host: GitHub
- URL: https://github.com/lesomnus/vanguard
- Owner: lesomnus
- License: apache-2.0
- Created: 2023-06-02T11:03:41.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-06T08:05:27.000Z (about 2 years ago)
- Last Synced: 2025-01-27T23:36:07.811Z (4 months ago)
- Topics: datachannel, signaling, webrtc
- Language: TypeScript
- Homepage:
- Size: 213 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vanguard
Make extra connections from the existing connection.
## Usage
```ts
import { SigChannel, SigMessage, offer } from 'vanguard'class MySigChannel implements SigChannel {
send(message: SigMessage): void {
// Implement it.
}close(): void {
// Implement it.
}get closed(): boolean {
// Implement it.
}
}async function connect() {
// Initial connection with third-party signalling server.
const conn = new RTCPeerConnection()
const peer = await offer(conn, new MySigChannel())// Need extra connection?
// Signaling through existing connection!
const extra_conn = new RTCPeerConnection()
const extra_peer = await peer.offer(extra_conn)
}
```## TODO
- [ ] Provide `SigChannel` for PeerJS.
- [ ] Handle renegotiation.