Socket
Book a DemoInstallSign in
Socket

@caves/ion-sdk-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@caves/ion-sdk-js

A js sdk for ion sfu

latest
npmnpm
Version
0.3.7-joinfix-1
Version published
Maintainers
1
Created
Source

ion-sdk-js

Frontend sdk for the Ion backend.

Installation

npm install ion-sdk-js

Usage

import { Client, LocalStream, RemoteStream } from 'ion-sdk-js';
const client = new Client({ url: 'wss://endpoint' });

// Setup handlers
client.on('peer-join', (uid: string, info: any) => {});
client.on('peer-leave', (uid: string) => {});
client.on('transport-open', () => {}));
client.on('transport-closed', () => {});
client.on('stream-add', (uid: string, info: any) => {});
client.on('stream-remove', (stream: RemoteStream) => {});
client.on('broadcast', (uid: string, info: any) => {});

// Join a room
client.join(rid, {
    name: "name"
});

// Leave current room
client.leave();

// Get a local stream
const local = await LocalStream.getUserMedia({
    audio: true,
    video: true
});

// Publish local stream
client.publish(local);

// Unpublish local stream
local.unpublish();

// Subscribe to a remote stream
const remote = client.subscribe(mid);

// Unsubscribe from a stream
remote.unsubscribe();

// Broadcast a payload to the room
client.broadcast(payload);

// Close client connection
client.close();

Keywords

pion

FAQs

Package last updated on 24 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts