我正在使用socket.io在一个NodeJS应用程序。socket.io页面位于localhost:8081/socket.io/中。但是,我想把它放在localhost:8081/hola/socket.io/中。这有可能吗?
var express = require("express");
var app = express();
var server = require("http").Server(app);
var io = require("socket.io")(server);
//some code here...
server.listen(8081, function() {
console.log("Server running at http://localhost:8081/");
});发布于 2016-02-11 11:36:36
只需在options数组中传入path,这是socket.io的第二个选项
var io = require("socket.io")(server, { path: '/hola/socket.io'});https://stackoverflow.com/questions/35337931
复制相似问题