|
|
@ -129,7 +129,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
webChannel.onopen = function () {
|
|
|
|
webChannel.onopen = function () {
|
|
|
|
resolve(webChannel);
|
|
|
|
resolve(webChannel);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}, reject);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
@ -222,7 +222,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
|
|
|
|
|
|
|
|
_createClass(WebChannel, [{
|
|
|
|
_createClass(WebChannel, [{
|
|
|
|
key: 'leave',
|
|
|
|
key: 'leave',
|
|
|
|
value: function leave() {}
|
|
|
|
value: function leave() {
|
|
|
|
|
|
|
|
this.topologyService.leave(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
key: 'send',
|
|
|
|
key: 'send',
|
|
|
|
value: function send(data) {
|
|
|
|
value: function send(data) {
|
|
|
@ -246,12 +248,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
key: 'sendTo',
|
|
|
|
key: 'sendTo',
|
|
|
|
value: function sendTo(id, msg) {
|
|
|
|
value: function sendTo(fromId, toId, msg) {
|
|
|
|
var channel = this;
|
|
|
|
var channel = this;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
var protocol = _ServiceProvider2.default.get(channel.settings.protocol);
|
|
|
|
var protocol = _ServiceProvider2.default.get(channel.settings.protocol);
|
|
|
|
console.log('WCsendTo ' + id);
|
|
|
|
channel.topologyService.sendTo(toId, channel, protocol.message(cs.USER_DATA, { id: fromId, data: msg })).then(resolve, reject);
|
|
|
|
channel.topologyService.sendTo(id, channel, protocol.message(cs.USER_DATA, { id: channel.myID, data: msg })).then(resolve, reject);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
@ -405,7 +406,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
value: function get(code) {
|
|
|
|
value: function get(code) {
|
|
|
|
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
|
|
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
|
|
|
|
|
|
|
|
|
|
var service = undefined;
|
|
|
|
var service = void 0;
|
|
|
|
switch (code) {
|
|
|
|
switch (code) {
|
|
|
|
case cs.WEBRTC_SERVICE:
|
|
|
|
case cs.WEBRTC_SERVICE:
|
|
|
|
service = new _WebRTCService2.default(options);
|
|
|
|
service = new _WebRTCService2.default(options);
|
|
|
@ -467,8 +468,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
|
|
|
|
|
|
|
|
_classCallCheck(this, FullyConnectedService);
|
|
|
|
_classCallCheck(this, FullyConnectedService);
|
|
|
|
|
|
|
|
|
|
|
|
console.log('SERVICE FULLY CONNECTED CONSTRUCTED');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_createClass(FullyConnectedService, [{
|
|
|
|
_createClass(FullyConnectedService, [{
|
|
|
@ -594,7 +593,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
key: 'leave',
|
|
|
|
key: 'leave',
|
|
|
|
value: function leave(webChannel) {
|
|
|
|
value: function leave(webChannel) {
|
|
|
|
this.broadcast(webChannel);
|
|
|
|
var protocol = _ServiceProvider2.default.get(cs.EXCHANGEPROTOCOL_SERVICE);
|
|
|
|
|
|
|
|
this.broadcast(webChannel, protocol.message(cs.LEAVING, { id: webChannel.myID }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
key: '_generateID',
|
|
|
|
key: '_generateID',
|
|
|
@ -846,7 +846,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
|
|
|
|
|
|
|
|
var settings = Object.assign({}, this.settings, options);
|
|
|
|
var settings = Object.assign({}, this.settings, options);
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
var connection = undefined;
|
|
|
|
var connection = void 0;
|
|
|
|
var socket = new window.WebSocket(settings.signaling);
|
|
|
|
var socket = new window.WebSocket(settings.signaling);
|
|
|
|
socket.onopen = function () {
|
|
|
|
socket.onopen = function () {
|
|
|
|
connection = new _this2.RTCPeerConnection(settings.webRTCOptions);
|
|
|
|
connection = new _this2.RTCPeerConnection(settings.webRTCOptions);
|
|
|
@ -869,6 +869,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
}, reject);
|
|
|
|
}, reject);
|
|
|
|
}, reject);
|
|
|
|
}, reject);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
socket.onclose = function (e) {
|
|
|
|
|
|
|
|
reject(e);
|
|
|
|
|
|
|
|
};
|
|
|
|
socket.onmessage = function (e) {
|
|
|
|
socket.onmessage = function (e) {
|
|
|
|
var msg = JSON.parse(e.data);
|
|
|
|
var msg = JSON.parse(e.data);
|
|
|
|
if (Reflect.has(msg, 'data')) {
|
|
|
|
if (Reflect.has(msg, 'data')) {
|
|
|
@ -963,8 +966,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
}, function () {});
|
|
|
|
}, function () {});
|
|
|
|
})();
|
|
|
|
})();
|
|
|
|
} else if (msg.sdp.type === 'answer') {
|
|
|
|
} else if (msg.sdp.type === 'answer') {
|
|
|
|
var sd = Object.assign(new this.RTCSessionDescription(), msg.sdp);
|
|
|
|
var _sd = Object.assign(new this.RTCSessionDescription(), msg.sdp);
|
|
|
|
webChannel.connections.get(msg.senderPeerID).setRemoteDescription(sd, function () {}, function () {});
|
|
|
|
webChannel.connections.get(msg.senderPeerID).setRemoteDescription(_sd, function () {}, function () {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (Reflect.has(msg, 'candidate')) {
|
|
|
|
} else if (Reflect.has(msg, 'candidate')) {
|
|
|
|
webChannel.connections.get(msg.senderPeerID).addIceCandidate(new this.RTCIceCandidate(msg.candidate));
|
|
|
|
webChannel.connections.get(msg.senderPeerID).addIceCandidate(new this.RTCIceCandidate(msg.candidate));
|
|
|
@ -1077,7 +1080,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
|
|
|
|
|
|
|
|
var settings = Object.assign({}, this.settings, options);
|
|
|
|
var settings = Object.assign({}, this.settings, options);
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
var connection = undefined;
|
|
|
|
var connection = void 0;
|
|
|
|
var socket = new window.WebSocket(settings.signaling);
|
|
|
|
var socket = new window.WebSocket(settings.signaling);
|
|
|
|
socket.seq = 1;
|
|
|
|
socket.seq = 1;
|
|
|
|
socket.facade = options.facade || null;
|
|
|
|
socket.facade = options.facade || null;
|
|
|
@ -1146,6 +1149,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
case cs.GET_HISTORY:
|
|
|
|
case cs.GET_HISTORY:
|
|
|
|
webChannel.onPeerMessage(msg.id, msg.code);
|
|
|
|
webChannel.onPeerMessage(msg.id, msg.code);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case cs.LEAVING:
|
|
|
|
|
|
|
|
webChannel.onLeaving(msg.id);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case cs.SERVICE_DATA:
|
|
|
|
case cs.SERVICE_DATA:
|
|
|
|
var service = _ServiceProvider2.default.get(msg.service);
|
|
|
|
var service = _ServiceProvider2.default.get(msg.service);
|
|
|
|
service.onmessage(channel, msg.data);
|
|
|
|
service.onmessage(channel, msg.data);
|
|
|
@ -1180,6 +1186,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
case cs.GET_HISTORY:
|
|
|
|
case cs.GET_HISTORY:
|
|
|
|
msg.id = data.id;
|
|
|
|
msg.id = data.id;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case cs.LEAVING:
|
|
|
|
|
|
|
|
msg.id = data.id;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case cs.SERVICE_DATA:
|
|
|
|
case cs.SERVICE_DATA:
|
|
|
|
msg.service = data.service;
|
|
|
|
msg.service = data.service;
|
|
|
|
msg.data = Object.assign({}, data.data);
|
|
|
|
msg.data = Object.assign({}, data.data);
|
|
|
@ -1312,7 +1321,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
key: 'message',
|
|
|
|
key: 'message',
|
|
|
|
value: function message(code, data) {
|
|
|
|
value: function message(code, data) {
|
|
|
|
var type = undefined;
|
|
|
|
var type = void 0;
|
|
|
|
switch (code) {
|
|
|
|
switch (code) {
|
|
|
|
case cs.USER_DATA:
|
|
|
|
case cs.USER_DATA:
|
|
|
|
type = 'MSG';
|
|
|
|
type = 'MSG';
|
|
|
|