reqFromSocket now support payload and event and uid

v1.18.x
Aziz Khoury 9 years ago
parent 02e53fd442
commit 8920c95281

@ -209,12 +209,15 @@ var cls = require('../middleware/cls');
};
Sockets.reqFromSocket = function (socket) {
Sockets.reqFromSocket = function (socket, payload, event) {
var headers = socket.request.headers;
var host = headers.host;
var referer = headers.referer || '';
var data = ((payload || {}).data || []);
return {
uid: socket.uid,
body: {event: event || data[0], params: data[1], payload: payload},
ip: headers['x-forwarded-for'] || socket.ip,
host: host,
protocol: socket.request.connection.encrypted ? 'https' : 'http',

Loading…
Cancel
Save