summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/hooks_server-side.md17
-rw-r--r--src/node/handler/PadMessageHandler.js2
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md
index 79879b2f..6ef65cc5 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 248dc128..cc1260c2 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -1009,6 +1009,8 @@ function handleClientReady(client, message)
var currentTime;
var padIds;
+ hooks.callAll("clientReady", message);
+
async.series([
//Get ro/rw id:s
function (callback)