mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-10 02:51:55 +00:00
36 lines
No EOL
923 B
HTML
36 lines
No EOL
923 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest((done) => {
|
|
const ws = new WebSocket('wss://websocket-echo.app.ladybird.org');
|
|
|
|
let messageCount = 0;
|
|
|
|
ws.onopen = function (ev) {
|
|
println(ev.type);
|
|
|
|
ws.onclose = function (ev) {
|
|
println(ev.type);
|
|
done();
|
|
}
|
|
ws.onerror = function (ev) {
|
|
println(ev.type);
|
|
done();
|
|
}
|
|
};
|
|
ws.onmessage = function (ev) {
|
|
if (ev.data.startsWith('WellHelloFriends')) {
|
|
println(`${ev.type} ${ev.data}`)
|
|
}
|
|
|
|
ws.send(`WellHelloFriends${messageCount}`);
|
|
if (messageCount++ === 5) {
|
|
ws.close();
|
|
}
|
|
}
|
|
ws.onerror = function (ev) {
|
|
println(ev.type);
|
|
done();
|
|
}
|
|
});
|
|
</script> |