diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 79879b2fe..6ef65cc54 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -384,3 +384,20 @@ exports.userLeave = function(hook, session, callback) { console.log('%s left pad %s', session.author, session.padId); }; ``` + +### clientReady +Called from src/node/handler/PadMessageHandler.js + +This in context: + +1. message + +This hook gets called when handling a CLIENT_READY which is the first message from the client to the server. + +Example: + +``` +exports.clientReady = function(hook, message) { + console.log('Client has entered the pad' + message.padId); +}; +``` diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 6515e17e1..e72625d06 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -1020,6 +1020,8 @@ function handleClientReady(client, message) var currentTime; var padIds; + hooks.callAll("clientReady", message); + async.series([ //Get ro/rw id:s function (callback)