summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/websockets/experiments/authentication/query_param.js
blob: 6a54d0b6caeb5288cf4248c1b4c7d299deee8a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
window.addEventListener("DOMContentLoaded", () => {
    const uri = `ws://localhost:8002/?token=${token}`;
    const websocket = new WebSocket(uri);

    websocket.onmessage = ({ data }) => {
        // event.data is expected to be "Hello <user>!"
        websocket.send(`Goodbye ${data.slice(6, -1)}.`);
    };

    runTest(websocket);
});