fix different whiteboard interference
This commit is contained in:
parent
88a2fe0dda
commit
f5311bcc97
@ -26,6 +26,8 @@ signaling_socket.on('connect', function () {
|
||||
signaling_socket.on('refreshUserBadges', function () {
|
||||
whiteboard.refreshUserBadges();
|
||||
});
|
||||
|
||||
signaling_socket.emit('joinWhiteboard', whiteboardId);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
20
server.js
20
server.js
@ -70,17 +70,35 @@ function progressUploadFormData(formData) {
|
||||
});
|
||||
}
|
||||
|
||||
var allUsers = {};
|
||||
io.on('connection', function(socket){
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
delete allUsers[socket.id];
|
||||
socket.broadcast.emit('refreshUserBadges', null);
|
||||
});
|
||||
|
||||
socket.on('drawToWhiteboard', function(content) {
|
||||
content = escapeAllContentStrings(content);
|
||||
socket.broadcast.emit('drawToWhiteboard', content);
|
||||
sendToAllUsersOfWhiteboard(content["wid"], content)
|
||||
s_whiteboard.handleEventsAndData(content); //save whiteboardchanges on the server
|
||||
});
|
||||
|
||||
socket.on('joinWhiteboard', function(wid) {
|
||||
allUsers[socket.id] = {
|
||||
"socket" : socket,
|
||||
"wid" : wid
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
function sendToAllUsersOfWhiteboard(wid, content) {
|
||||
for(var i in allUsers) {
|
||||
if(allUsers[i]["wid"]==wid) {
|
||||
allUsers[i]["socket"].emit('drawToWhiteboard', content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Prevent cross site scripting
|
||||
function escapeAllContentStrings(content, cnt) {
|
||||
|
Loading…
Reference in New Issue
Block a user