目的
给多线程/多服务器进行排队。
安装/下载
npm install queue-core
开启服务器
const QueueServer = server;const server = ;serverstart; // 默认端口8879// server.start([port]);
连接服务器
const QueueClient = client;const client = ;clientstart; // 默认端口8879// client.start([port[, host]]);
排队处理
client
Document
QueueClient
Class:new QueueClient()
Creates a new client object.
connect
Event:Emitted when a socket connection is successfully established.
error
Event:Emitted when an error occurs.
client.start([port[, host]])
Initiate a connection on a given client.
client.lock(name)
lock
client.unlock(name)
unlock
client.wait(name)
加入队列,直到请求前所有同名请求unlock之后返回,超时则返回false