Open Jing-Springshare opened 11 years ago
All recent
WebRTC Experiments and libraries are capable to work with each and every signaling gateway. Signaling process is highly simplified. If you want to use socket.io over node.js
, here is your signaler.js
code:
io.sockets.on('connection', function (socket) {
socket.on('message', function (data) {
socket.broadcast.emit('message', data);
});
});
And here is the client-side code overriding openSignlaingChannel
method:
connection.openSignalingChannel = function(callback) {
return io.connect().on('message', callback);
};
Try New Screen Sharing Demo. Source Code
onmessage
is passed over callback
objectreturn socket;
That socket instance must have a send
method. Otherwise; you should declare a custom send
method there:
// declaring custom "send" method
socket.send = function(data) {
xhr.post('/controller/action', data);
};
connection.openSignalingChannel = function (callback) {
var websocket = new WebSocket('ws://domain:protocol/');
// data from "onmessage" must be passed over "callback" object
websocket.onmessage = function (e) {
callback(e.data);
};
// socket object must be returned for reusability
return websocket;
};
connection.openSignalingChannel = function (callback) {
var username = Math.round(Math.random() * 60535) + 5000;
var client = new fm.websync.client('websync.ashx');
client.setAutoDisconnect({
synchronous: true
});
// received message must be passed over "callback" object
client.connect({
onSuccess: function () {
client.join({
channel: '/namespace',
userId: username,
userNickname: username,
onReceive: function (event) {
callback(event.getData().text);
}
});
}
});
// must have a "send" method
return {
send: function (message) {
client.publish({
channel: '/namespace',
data: {
username: username,
text: message
}
});
}
};
};
connection.openSignalingChannel = function (callback) {
var messages = {};
function repeatedlyCheck() {
xhr('/GetData', function (data) {
if (data != false && !messages[data.ID]) {
messages[data.ID] = data.Message;
// data must be passed over "callback" object
callback(data.Message);
setTimeout(repeatedlyCheck, 1);
} else setTimeout(repeatedlyCheck, 400);
});
}
repeatedlyCheck();
// if there is no "send" method
// must declare one
// also socket instance must be returned
return {
send: function (data) {
xhr('/PostData', null, data);
}
};
};
Hello, @muaz-khan Is it possible to share desktop screen without using any extension ? Just by capturing the screen stream and displaying it ?? what constraints should i use ??
I noticed the Pluginfree-Screen-Sharing is using the services at firebaseio.com
Is that possible to self hosted it?
Which node.js file we could use to start the services?
Thanks,