我有一个问题Express.io
:我尝试创建一个聊天,但我无法使用该Broadcast
方法。
没有错误消息,但没有任何反应。
应用程序.js
var express = require('express.io')
, index = require('./routes/index.js')
, http = require('http')
, path = require('path');
var app = express();
app.configure(function(){
//configure options
});
app.http().io();
app.get('/', index.index);
app.io.route('ready', function(req) {
req.io.broadcast('newUser');
});
app.listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
用户.js
io = io.connect();
io.emit('ready');
io.on('newUser', function(data) {
console.log("New user !!");
});
错误 2
WebSocket connection to 'ws://tchat.aws.af.cm/socket.io/1/websocket/n8Jm9Q7YYL8YdPRN4dxU' failed: Unexpected response code: 502