logging.io
v0.0.0-alpha.0
Published
Logging.io.
Downloads
1
Readme
client.io
构建Web端更稳定高效的实时通信解决方案。
Use
Use npm/yarn/pnpm
pnpm add client.io
Example
WebSocketBucket.create({
name: 'ACK_WEBSOCKET',
url: 'wss://wss.github.com/test-ws'
heartRate: 5000,
heartbeat: (send) => {
send(
'HeartBeat-client-' + `${new Date().getSeconds()}`,
);
},
receive: (event) => {
if (event.data) {
const data = jsonStringify2Parse(event.data);
if (data.ack && data.msgId) {
setTimeout(() => {
WebSocketBucket.sendMessage(
JSON.stringify({ module: 'ack', msgId: data.msgId }),
'ACK_WEBSOCKET',
);
}, 0);
}
}
return event;
},
send: (event) => {
return event;
},
});
WebSocketBucket.receiveMessage((msgEvent) => {
}, 'ACK_WEBSOCKET');
WebSocketBucket.receiveMessage((msgEvent) => {
}, 'ACK_WEBSOCKET');