mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 22:40:01 -04:00
bugfixes for websocket api
This commit is contained in:
parent
7284487430
commit
3a50060e07
7 changed files with 13 additions and 10 deletions
|
@ -1,8 +1,8 @@
|
|||
function test() {
|
||||
let message_len = 128*1024;
|
||||
let message_len = 1024;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let ws = new libcurl.WebSocket("wss://echo.websocket.org");
|
||||
let ws = new libcurl.WebSocket("wss://echo.websocket.in/");
|
||||
ws.addEventListener("open", () => {
|
||||
ws.send("hello".repeat(message_len));
|
||||
});
|
||||
|
@ -12,8 +12,8 @@ function test() {
|
|||
messages += 1;
|
||||
if (messages >= 2) {
|
||||
if (event.data !== "hello".repeat(message_len)) reject("unexpected response");
|
||||
if (messages >= 11) resolve();
|
||||
ws.send("hello".repeat(message_len));
|
||||
else if (messages >= 11) resolve();
|
||||
else ws.send("hello".repeat(message_len));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue