@lesomnus/vanguard
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Vanguard

Make extra connections from the existing connection.

Usage

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @lesomnus/vanguard

Weekly Downloads

0

Version

0.0.2

License

Apache-2.0

Unpacked Size

80.2 kB

Total Files

9

Last publish

Collaborators

  • lesomnus