I am basically trying to only allow 2 clients to connect to the app concurrently. How should I approach this?
我基本上只是尝试允许2个客户端同时连接到该应用程序。我该怎么办呢?
This is my server code:
这是我的服务器代码:
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
var osc = require('node-osc');
var client = new osc.Client('127.0.0.1', 12345);
server.listen(3000);
app.get('/', function(req, res){
res.sendfile(__dirname + '/index.html');
});
io.sockets.on('connection', function(socket){
socket.on('send message', function(data){
client.send('/oscAddress', parseInt(data));
});
});
1 个解决方案
#1
10
You can try with
你可以试试
server.maxConnections = 2;
Never used it but is looks like it's the way to go if I trust the Node.js documentation
从来没有使用它,但如果我信任Node.js文档,它看起来就像是要走的路
#1
10
You can try with
你可以试试
server.maxConnections = 2;
Never used it but is looks like it's the way to go if I trust the Node.js documentation
从来没有使用它,但如果我信任Node.js文档,它看起来就像是要走的路