Tag: socket.io

Google Container Engine (Kubernetes): Websocket (Socket.io) not working on multiple replicas

I am new to Google Container Engine (GKE). When run on localhost it’s working fine but when I deploy to production with GKE I got websocket error. My node app is develop with Hapi.js and Socket.io and my structure is shown in image below. Application Architecture I’m using Glue to compose Hapi server. Below is […]

Socket.io – how to use listeners

I’ve looked around for an answer regarding this question, I am not sure if I am going about this the right way. I have a node.js application that uses socket.io to push and receive data from the node server to the client. Most of the requests sent to nodejs are through HTTP Requests while the […]

nodejs setMaxListeners to avoid memory leak detection

I read some other questions and posts, but I couldn’t find where to apply .setMaxListeners(0). I’m using a simple websocket-server which comes up with the errer: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace at Socket.EventEmitter.addListener (events.js:160:15) at Socket.Readable.on (_stream_readable.js:689:33) at XHRPolling.Transport.setHandlers (D:\nodeJS\host\node_modules\socket.io\lib\transport.js:116:15) at XHRPolling.HTTPPolling.setHandlers (D:\nodeJS\host\node_modules\socket.io\lib\transports\http-polling.js:53:39) at […]

Using Passport.SocketIO cookie parser error

I am using the following: “dependencies”: { “express”: “^4.0.0”, “socket.io”: “0.9.16”, “mongoose”: “^3.8.8”, “passport”: “^0.2.0”, “passport-local”: “^1.0.0”, “express-session”: “^1.0.3”, “cookie-parser”: “^1.0.1”, “body-parser”: “^1.0.2”, “session-mongoose”: “git://github.com/danpe/session-mongoose.git#master”, “passport.socketio”: “^3.0.1” } Setting my socket.io authorization: io.set(“authorization”, passportSocketIo.authorize({ passport : passport, cookieParser: cookieParser(), key: settings.sessionKey, //the cookie where express (or connect) stores its session id. secret: settings.sessionSecret, //the session […]

How do you export a variable from app.js into another route in Node js

i’m using socket.io in my node project and wanted to know how to possibly export the io variable this is what i have done so far but i get this error: Object #<Object> has no method ‘on’ in app.js: var express = require(‘express’); var path = require(‘path’); var favicon = require(‘serve-favicon’); var logger = require(‘morgan’); […]

SocketIO groups

I’m trying SocketIO and I’m stuck. I can’t find any proper documentation. Here is a sample code of what I’d like to do : io.sockets.in(‘group1’).join(‘group2’); io.sockets.in(‘group3’).on(‘message’, function(){}); Is there any workaround to those two particular actions ?

Why I get 'Cannot GET /' on my express server?

I wrote a minimalistic example of a server with node.js with which I want to get console notification that client connected. I am using following version of modules express@3.0.6 socket.io@0.9.13 node@0.8.7 So I wrote this : app.js var socket = require(‘socket.io’); var express = require(‘express’); var http = require(‘http’); var app = express(); var server […]

Express.io, socket.io.js not found

I got an issue with Express.io, I try to create a simple tchat. But I’m not be able to include the socket.io.js, I got an error… I just installed Express.io on my new Express project. My errors : GET http://***/socket.io/socket.io.js 404 (Not Found) localhost:1 Uncaught ReferenceError: io is not defined Index.jade doctype 5 html head […]

socket.io – ReferenceError: socket is not defined

I’m trying to write a simple app that mirrors each character I type in a text area onto a div using socket.io, but I keep getting the following client error: “ReferenceError: socket is not defined” Here’s my server code: var express = require(‘express’), app = express(), server = require(‘http’).createServer(app), io = require(‘socket.io’).listen(server); server.listen(3000); app.get(‘/’, function(req,res){ […]

Build Error when Installing Socket.IO on Ubuntu 14.04

I seem to be getting the same error over several times. I keep getting this (node-gyp rebuild 2> builderror.log) || (exit 0) message. What exactly is it? Also is the node.js redis module no longer included with socket.io? ubuntu@ip-10-180-52-29:~$ sudo npm install socket.io > ws@0.4.31 install /home/ubuntu/node_modules/socket.io/node_modules/engine.io/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0) […]

Node.js is the Best Javascript runtime in the world.