--
You received this message because you are subscribed to the Google Groups "actionHero.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionhero-j...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
incoming: function (message, request, callback) {
// Let non-subscribe messages through
if (message.channel !== '/meta/subscribe')
return callback(message);
var token = message.ext && message.ext.token ? message.ext.token : '';
if (verifyToken(token)) {
message.error = "Authentication failed. Please authenticate again.";
} else {
// alter connection here by adding data to the message
message.user = 'test';
}
callback(message);
}
However, I haven't found a way to alter the message in a way that I later have the user object in the websocket connection:
var onWebsocketConnection = function (connection) {
console.log(connection.user); }
api.connections.createCallbacks.push(onWebsocketConnection);