我有2个工作的NodeJS应用程序。在一个我使用快递和另一个http.createServer。我按照这里的文档尝试将它们组合起来
https://github.com/Automattic/socket.io/tree/0.9.17
我正在使用socketIO * 0.9 **&表达 4.11.2 。
var express = require('express');
var app = express();
var multer = require('multer'),
io = require('socket.io').listen(app,{transports:['flashsocket', 'websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']})
, fs = require('fs'),
ffmpeg = require('./lib/fluent-ffmpeg');
var server = require('http').createServer(app)
, io = io.listen(server);
var port = Number(8080);
server.listen(port);
这是完整的错误消息。据我所知,我已经定义了 server ,就像文档一样。
Socket.IO's `listen()` method expects an `http.Server` instance
as its first parameter. Are you migrating from Express 2.x to 3.x?
If so, check out the "Socket.IO compatibility" section at:
https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x
info - socket.io started
/Users/foo/Documents/app.js:12
, io = io.listen(server);
^
TypeError: Object #<Manager> has no method 'listen'