基本上,我有一个由apache在端口1900上运行的网页,还有一个运行在端口3000上的NodeJS服务器。服务器代码:
var express = require('express');
var http = require('http');
//make sure you keep this order
var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);
var port = 3000;