mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Add in an HTTP API call to send a custom message type.
You cannot currently send any data with your custom message, but this patch is just begging for a second one that will allow that.
This commit is contained in:
parent
aa986ab954
commit
3d4fb81796
3 changed files with 57 additions and 1 deletions
|
@ -272,6 +272,28 @@ function handleSaveRevisionMessage(client, message){
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a custom message (sent via HTTP API request)
|
||||
*
|
||||
* @param padID {Pad} the pad to which we're sending this message
|
||||
* @param msg {String} the message we're sending
|
||||
*/
|
||||
exports.handleCustomMessage = function (padID, msg, cb) {
|
||||
var time = new Date().getTime();
|
||||
var msg = {
|
||||
type: 'COLLABROOM',
|
||||
data: {
|
||||
type: msg,
|
||||
time: time
|
||||
}
|
||||
};
|
||||
for (var i in pad2sessions[padID]) {
|
||||
socketio.sockets.sockets[pad2sessions[padID][i]].json.send(msg);
|
||||
}
|
||||
|
||||
cb(null, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a Chat Message
|
||||
* @param client the client that send this message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue