这个套接字.io在以下函数中启动服务器.asp
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
var baseUrl = app.get('url').replace(/\/$/, '');
console.log('Web server listening at: %s', baseUrl);
if (app.get('loopback-component-explorer')) {
var explorerPath = app.get('loopback-component-explorer').mountPath;
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
}
});
};
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, function(err) {
if (err) throw err;
app.emit('started');
// start the server if `$ node server.js`
/* if (require.main === module) { */
// app.start();
app.io = require('socket.io')(app.start());
app.io.set('transports', ['websocket']);
app.io.socketIOConnectionCounter = setInterval(() => {
console.log(`total connections: ${app.io.engine.clientsCount}`);
}, 1000 * 60);
console.log('Socket.io started');
}
app.io = require('socket.io')(app.start());
而不是现在的lb3app。我该怎么做?(将lb4的应用程序传递到该功能中,而不是已安装的lb3的应用程序)?
这很重要,因为如果我保持原样,那么lb3启动httpserer,服务器已经启动了,因为应用服务器已经由lb4启动了,所以端口已经被占用了。