我基本上试图只允许 2 个客户端同时连接到应用程序。我应该如何处理这个?
这是我的服务器代码:
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));
});
});