Debian Codegraph @

testing/web-platform/tests/tools/third_party/websockets/experiments/authentication/first_message.js

raw
1 window.addEventListener("DOMContentLoaded", () => {
2 const websocket = new WebSocket("ws://localhost:8001/");
3 websocket.onopen = () => websocket.send(token);
4
5 websocket.onmessage = ({ data }) => {
6 // event.data is expected to be "Hello <user>!"
7 websocket.send(`Goodbye ${data.slice(6, -1)}.`);
8 };
9
10 runTest(websocket);
11 });