mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-15 03:26:53 -04:00
Merge 5639bde5ad
into babb33d825
This commit is contained in:
commit
0f7fdf39cc
1 changed files with 17 additions and 0 deletions
|
@ -254,6 +254,23 @@ function handleSaveRevisionMessage(client, message){
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a custom message, different to the function below as it handles objects not strings and you can direct the message to specific sessionID
|
||||
*
|
||||
* @param msg {Object} the message we're sending
|
||||
* @param sessionID {string} the socketIO session to which we're sending this message
|
||||
*/
|
||||
exports.handleCustomObjectMessage = function (msg, sessionID, cb) {
|
||||
if(sessionID){ // If a sessionID is targeted then send directly to this sessionID
|
||||
io.sockets.socket(sessionID).emit(msg); // send a targeted message
|
||||
}else{
|
||||
socketio.sockets.in(msg.data.padId).json.send(msg); // broadcast to all clients on this pad
|
||||
}
|
||||
|
||||
cb(null, {});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles a custom message (sent via HTTP API request)
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue