Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in cloud9 IDE #276

Closed
baio opened this issue Jun 22, 2011 · 8 comments
Closed

Doesn't work in cloud9 IDE #276

baio opened this issue Jun 22, 2011 · 8 comments

Comments

@baio
Copy link

baio commented Jun 22, 2011

I've installed socket module - npm install socket.io

When I create server simple like this:

var io = require('socket.io').listen(process.env.C9_PORT);

When I got this exception:

debugger listening on port 5860
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object 20002 has no method 'listeners'
at new Manager (/mnt/ws/users/baio/52249/node_modules/socket.io/lib/manager.js:85:30)
at Object.listen (/mnt/ws/users/baio/52249/node_modules/socket.io/lib/socket.io.js:70:10)
at Object. (/mnt/ws/users/baio/52249/websocket.server.js:1:93)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array. (module.js:423:10)
at EventEmitter._tickCallback (node.js:126:26)

@rauchg
Copy link
Contributor

rauchg commented Jun 22, 2011

Remember the 0.7 API changed. Please consult the README.

@rauchg rauchg closed this as completed Jun 22, 2011
@baio
Copy link
Author

baio commented Jun 22, 2011

Hmmm.Is it meant what c9.io now has obsoleted version of the module and if so when it will be updated?

@MikeTatsky
Copy link

Sorry, I also can not run socket.io on c9.io
Here is log

Any suggestions?

/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/manager.js:104
server.on('error', function(err) {
^
TypeError: Object 8080 has no method 'on'
at new Manager (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/manager.js:104:10)
at Object.listen (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/socket.io.js:78:10)
at Object. (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/index.js:1:93)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:190:38)
Running Node Process
Tip: you can access long running processes, like a server, at 'http://zingsocketio.mikhailtatsky_1.c9.io'.
Important: in your scripts, use 'process.env.PORT' as port and 'process.env.IP' as host.
debugger listening on port 15400
/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/manager.js:104
server.on('error', function(err) {
^
TypeError: Object 8080 has no method 'on'
at new Manager (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/manager.js:104:10)
at Object.listen (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/node_modules/socket.io/lib/socket.io.js:78:10)
at Object. (/var/lib/stickshift/13881f8548e0437d85a9c9028dc08ec1/app-root/data/258575/index.js:1:93)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)

@GICodeWarrior
Copy link
Contributor

What are you passing into the listen call?

@MikeTatsky
Copy link

I tried this

var io = require('socket.io').listen(process.env.PORT, process.env.IP);

and just this

var io = require('socket.io').listen(process.env.PORT);

@GICodeWarrior
Copy link
Contributor

It looks like process.env.PORT is a Number object instead of a primitive. Socket.io probably shouldn't care, but give this a try.

var io = require('socket.io').listen(process.env.PORT.valueOf());

@MikeTatsky
Copy link

Thank you for idea

process.env.PORT is string.
I tryed your varient. It does not work because return string.

var io = require('socket.io').listen(process.env.PORT.valueOf());

But these works.

var io = require('socket.io').listen(Number(process.env.PORT));

and

var io = require('socket.io').listen(+process.env.PORT);

@mikeatlas
Copy link

+1 this was the same problem I encountered on Heroku. Also worth noting on heroku was that for SSL + WebSockets to work, I had to enable WebSocket support first, and then provision the SSL endpoint: https://devcenter.heroku.com/articles/heroku-labs-websockets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants