summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/websockets/experiments/authentication/user_info.js
blob: 1dab2ce4c1709a743d527ab1142c26a293053072 (plain)
1
2
3
4
5
6
7
8
9
10
11
window.addEventListener("DOMContentLoaded", () => {
    const uri = `ws://token:${token}@localhost:8004/`;
    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);
});