Signaling Gateway for Skyway and Janus Gateway
$ npm -g install skyway-signaling-gateway
$ ssg setup
# register your API key.
$ ssg start
We support three features shown below.
- bidirectional data channel communication
- 3rd party interface is TCP (by default 15000)
- interface for janus skyway plugin is also TCP (by default 14999)
- one-way media stream from Janus Gateway
- leveraging streaming plugin of Janus Gateway
- 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.
const mypeerid;
const peer = new Peer(key: MY_APIKEY);
peer.on('open', id => { mypeerid = id; });
const conn = peer.connect(PEERID_OF_SSG, {serialization: "none", reliable: true});
conn.on('open', () => { conn.send('hello'); });
navigator.mediaDevices.getUserMedia({audio: true, video: false})
.then( stream => { peer.call(PEERID_OF_SSG, stream) } );
// 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');
You have two way.
- set it in conf/skyway.yaml
- set PEERID environment while running process
$ PEERID=ssgid node app.js
(preamble of SSG_
will be added to assigned peerid)
setting envronment will overwrite it in skyway.yaml
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
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
use ROOMNAME env
ROOMNAME=testroom node app.js
- JANUS_REST_SCHEME
http
orhttps
- JANUS_ENDPOINT_ADDR
- e.g.
localhost
- e.g.
- JANUS_REST_PORT
- e.g.
8089
- e.g.
- JANUS_DATA_PORT
- e.g.
14999
- e.g.
use MQTT_TOPIC and MQTT_URL env
MQTT_URL=mqtt://localhost MQTT_TOPIC=testtopic node app.js
- Install mosquitto
$ sudo apt-get -y install mosquitto
- test with mosquitto_client
Install mosquitto client
$ sudo apt-get -y install mosquitto-clients
publish
$ mosquitto_pub -m 'test' -t 'testtopic/a'
subscribe
$ mosquitto_sub -t 'testtopic/a'
$ npm test
$ npm run test:watch
license Apache-2.0