我有創建Azure移動服務自定義腳本的問題,我想使用Socket.IO Node.js模塊,但我不知道如何編輯Azure移動服務路線才能夠訪問/socket.io/1Azure移動服務 - Socket.IO集成
執行此代碼後,socket.io啓動,但客戶端無法從瀏覽器訪問URL端點,請幫助我,預先感謝您,我的電子郵件是:stepanic.matija @ gmail.com
我的代碼是:
在/ API /通知
exports.register = function (api) {
api.get('socket.io',getSocketIO);
};
function getSocketIO(req,res)
{
var app = require('express')()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
server.listen(80);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
res.send(statusCodes.OK, { message : '23 Hello World!', bla: 'bla2' });
}