spreadcast
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "spreadcast", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Broadcast a WebRTC stream to many subscribers", | ||
@@ -5,0 +5,0 @@ "main": "src/spreadcast.js", |
@@ -24,7 +24,8 @@ var _ = require('eakwell'); | ||
var socket; | ||
var sockReady; | ||
var socketReady; | ||
var shutdown = false; | ||
var openSocket = function() { | ||
socket = new WebSocket(wsUrl); | ||
sockReady = new Promise(function(ok, fail) { | ||
socketReady = new Promise(function(ok, fail) { | ||
socket.onopen = function(event) { | ||
@@ -42,5 +43,7 @@ console.log("Socket open"); | ||
console.log('WebSocket was closed', event); | ||
if(shutdown) return; | ||
// Reconnect socket and stream | ||
_.defer(function() { | ||
openSocket(); | ||
if(senderPeer) sockReady.then(reconnect); | ||
if(senderPeer) socketReady.then(reconnect); | ||
}, 1000); | ||
@@ -109,3 +112,3 @@ }; | ||
var send = function(data) { | ||
sockReady.then(function() { | ||
socketReady.then(function() { | ||
data._spreadcast = true; | ||
@@ -171,2 +174,4 @@ socket.send(JSON.stringify(data)); | ||
remoteVideo = null; | ||
shutdown = true; | ||
socket.close(); | ||
}; | ||
@@ -173,0 +178,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13456
354