Meteor + Socket.io


#1

Hello,

I was trying to make Meteor and Socket.io work since I need to use Socket.io as signaling server for WebRTC app.

With Meteor 1.3, would you know how I can convert this line (server-side Socket.io)?

var io = require('socket.io')(80);

http://socket.io/docs/

Thanks


#3

See my example projet


#4

Hello akryum,

Thanks so much for this especially the server-side way of doing it. I had the same workaround for the client side. :smile:

I wonder, will the PORT variable not have any issues when deployed? Is there a reason why it’s 8080 instead of 3000?

Maybe it can be like

const PORT = process.env.PORT || 8080

Anyways, I’ll check when I got home


#5

You cannot use the same port as meteor or socket will throw a Address in use Error.
I updated the example project to be able to set the port with an environment variable.

Alternatively, we could use a connect or express server and redirect calls to ‘/socket’ to our socket server like this.