From 66ddac2c71bf1effbcaea673591a2af9a08c5667 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Tue, 14 Oct 2014 13:51:52 +0300 Subject: [PATCH] [WO-594] Return own hostname for 'hostname' call from socket.io --- server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.js b/server.js index db78536..e6b71f0 100644 --- a/server.js +++ b/server.js @@ -5,6 +5,7 @@ process.chdir(__dirname); var cluster = require('cluster'); var config = require('config'); var log = require('npmlog'); +var os = require('os'); log.level = config.log.level; @@ -176,6 +177,10 @@ io.on('connection', function(socket) { log.info('io', 'Closed connection [%s]', socket.conn.id); socket.removeAllListeners(); }); + + socket.on('hostname', function(fn) { + fn(os.hostname()); + }); }); //