Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Socket.io runs fine locally, but not found on Azure

I'm fairly new to Node.js, and trying to build an application for myself. I am using socket.io and it works perfectly fine locally during testing, but when I deploy to Azure I keep getting

http://domain/socket.io/socket.io.js 404 (Not Found)

I have tried most methods and fixes I could find on forums but nothing seems to work, web sockets is enabled on Azure.

My code as below:

Client side:

<script src="/socket.io/socket.io.js"></script>

Server side

var express = require('express');
var port = process.env.port || 1337;
var app = require('express')()
  , server = require('http').createServer(app)
  , io = require('socket.io').listen(server, { log: false });

server.listen(port);

Any help is much appreciated, thanks in advance.

like image 331
CyrisXD Avatar asked Sep 01 '25 22:09

CyrisXD


1 Answers

How did you include the modules?

The easiest way is to create a package.json file (npm init) and then include that alongside your app.js.

See http://www.windowsazure.com/en-us/documentation/articles/nodejs-use-node-modules-windows-azure-apps/

like image 149
kiwidev Avatar answered Sep 03 '25 13:09

kiwidev