// window1.html
const server = new Server();
console.log(await server.endpoint); // unique-generated-code-abcde
for await (const { message, reply } of server) {
reply('Hello, ' + message);
}
// window2.html
const client = new Client('unique-generated-code-abcde');
const response = await client.send('Peerless');
console.log(response);
// Hello, Peerless
Good Stuff π:
- peer-to-peer β direct connection between browsers (fast!)
- 1:N β let loads of people connect to you
- streaming β for fun/interactive UIs