How to start up a node.js socket.io-redis server

  • Unknown's avatar

    I just watched an online video by Guillermo Rauch called “Realtime Communication with Socket.IO and WordPress”. This has convinced me to use node.js, socket.io and socket.io-redis to accomplish my aims to communicate bidirectionally between browsers and server. I have been able to communicate between two js scripts running on ssh. However i have yet to accomplish bidirectional communication between php (on a wordpress page) and a node.js socket.io server, using redis. From what i have seen on-line, I need to get a socket.io-redis sever up and running as one of the main steps. The demo by Guillermo is straight forward. But i have not been able to figure out how to get that redis server going. Does anyone know how to get a socket.io-redis server started on a site? Thanks, phil marks sr.

  • Unknown's avatar

    The following is the simple server-side js test code which should run without errors if the redis sever were up and running.

    `// node server file emsave.js
    var io= require(‘socket.io’)(9100);
    io.adapter(require(‘socket.io-redis’)
    ({ host: ‘http://www.mysimplesurvey.com’}));
    io.on(‘connection’,function(){
    console.log(‘this should work’);
    }); `

    Right now trying to run this code on my server’s ssh returns the following error:

    `(email visible only to moderators and staff) [~/public_html/EmitterPHP]# node emsave.js
    events.js:85
    throw er; // Unhandled ‘error’ event
    ^
    Error: Redis connection to http://www.mysimplesurvey.com:6379 failed – getaddrinfo ENOTFOUND http://www.mysimplesurvey.com
    at RedisClient.flush_and_error (/home2/mysimpp7/public_html/EmitterPHP/node_modules/socket.io-redis/node_modules/redis/index.js:142:13)
    at RedisClient.on_error (/home2/mysimpp7/public_html/EmitterPHP/node_modules/socket.io-redis/node_modules/redis/index.js:180:10)
    at Socket. (/home2/mysimpp7/public_html/EmitterPHP/node_modules/socket.io-redis/node_modules/redis/index.js:95:14)
    at Socket.emit (events.js:107:17)
    at net.js:915:16
    at process._tickCallback (node.js:343:11)
    (email visible only to moderators and staff) [~/public_html/EmitterPHP]# `

  • Unknown's avatar

    Hey there, I think the tutorial was referring to using wordpress.org with socket.io. You are currently on wordpress.com. You can find the wordpress.org forums here: https://wordpress.org/support/.

  • Unknown's avatar

    We provide support only for WordPress.COM blogs and that site is not one of them.

    WordPress.COM and WordPress.ORG are completely separate and have different logins, features, run different versions of some themes with the same names, and have separate support forums. read the differences here > http://en.support.wordpress.com/com-vs-org/

    If you don’t have a username account at WordPress.ORG click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there.

    Resetting your WordPress.ORG password http://codex.wordpress.org/Resetting_Your_Password
    WordPress.org support docs are at https://codex.wordpress.org/Main_Page

  • The topic ‘How to start up a node.js socket.io-redis server’ is closed to new replies.