You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
460 B
25 lines
460 B
4 years ago
|
const sock = new WebSocket("ws://localhost:7777");
|
||
|
|
||
|
sock.addEventListener('open', () => {
|
||
|
(async ()=> {
|
||
|
const mw = new MessageQueue(sock);
|
||
|
|
||
|
let msg = await mw.read();
|
||
|
console.log(`=> ${msg}`);
|
||
|
let next = await mw.send("uwu");
|
||
|
console.log(`now => ${next}`);
|
||
|
|
||
|
mw.close();
|
||
|
|
||
|
|
||
|
await (async () => {
|
||
|
const mw = new MessageQueue(sock);
|
||
|
|
||
|
let msg = await mw.send("OWO");
|
||
|
console.log(`other ${msg}`);
|
||
|
|
||
|
mw.close(true);
|
||
|
})();
|
||
|
})();
|
||
|
});
|