Skip to content

hirozonet/skyway-signaling-gateway

 
 

Repository files navigation

SSG - Skyway Signaling Gateway

Signaling Gateway for Skyway and Janus Gateway

How to install and setup

see SkyWay IoT SDK install manual

Supported features

We support three features shown below.

  1. bidirectional data channel communication
  • 3rd party interface for this is TCP (by default 15000)
  1. one-way media stream from Janus Gateway
  • leveraging streaming plugin of Janus Gateway
  1. one-way voice stream to Janus Gateway
  • 3rd party interface for this is UDP (by default 25000)

Below, we'll show up web Snipets for web app, iOS, Android to utilize these features leveraging SkyWay SDK.

web app

initialize peer

const mypeerid;
const peer = new Peer(key: MY_APIKEY);

peer.on('open', id => { mypeerid = id; });

use data channel

const conn = peer.connect(PEERID_OF_SSG, {serialization: "none", reliable: true});
conn.on('open', () => { conn.send('hello'); });

upstream client side media

navigator.mediaDevices.getUserMedia({audio: true, video: false})
  .then( stream => { peer.call(PEERID_OF_SSG, stream) } );

get media downstream from Janus Gateway

// we assume datachannel already establlished.

// set handler for Janus side media stream.
peer.on('call', stream => { $("#video").attr("src", window.URL.createObjectURL(stream) });

// request call
conn.send(`SSG:stream/start,${mypeerid}`)
...

// stop call
conn.send('SSG:stream/stop');

how to set SSG's peerid

You have two way.

  • set it in conf/skyway.yaml
  • set PEERID environment while running process
$ PEERID=ssgid node app.js

setting envronment will overwrite it in skyway.yaml

enable automatic execution of streaming process (alpha feature)

You can automatically execute streaming process. To enable this feature, set ENABLE_AUTO_STREAMING=true while starting process as shown below.

$ ENABLE_AUTO_STREAMING=true node app.js

Also, you need to set the path of streaming process in janus.yaml.

streaming_process: "/bin/bash ~/signalinggateway/skywayiot-sdk-test/media_streaming_transfer_test.sh"

force OPUS

By setting FORCE_OPUS=true while starting process, you can force audio codec to opus from client to Janus Gateway.

$ FORCE_OPUS=true node app

setup apikey, origin, secure and uuid parameters from environment for development purpose

use SSG_APIKEY, SSG_ORIGIN, SSG_SECURE and SSG_UUID for each

SSG_APIKEY=XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX SSG_ORIGIN=http://localhost SSG_UUID="test-uuid" node app.js

Testing

run unit test

$ npm test

watch

$ npm run test:watch

license Apache-2.0

About

A protocol gateway between Janus REST API and SkyWay Signaling

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.9%
  • Other 1.1%