lundi 30 mars 2015

AZURE + SOCKET.IO: How do I know which port my Web App is using?

I went to a Hackathon last weekend and a Microsoft recruiter set me up with Azure for my Node.js project.


We used Socket.io with my project and had a hard time connecting the Client to the Server because we didn't know which port to connect to...


On our WebApp (not Azure VM), we had the following code:



var port = process.env.port || 3000;


On the client side of Socket.io, I had to specify an ip address to use along with it's port. I tried:



var socket = io('http://ift.tt/1OPOP6k'); //And
var socket = io('http://IP.AD.DRE.SSS'); //And even a different Port
var socket = io('http://ift.tt/1BVWHZS'); //And 443 and 80


And every iteration... I had to be doing something wrong. We ended up switching over to Digital Ocean because I knew how to use it but I really wanted to get this working.


Any Ideas?


UPDATE:

I changed it to 80 and my current error is: "Access Control Allow Origin." Note: My client is running on a server.


UPDATE 2: Return of the OP

Unfortunately, the CORS package for Node did not do the trick...


Some more info:

I'm not using Express or Connect. My server is on Azure (as an Azure Web App). My Client was on Localhost (Thanks to WebStorm).


Aucun commentaire:

Enregistrer un commentaire