The new server in this PR uses all of the same logic that we currently use in the server.ts file. Only difference is it doesn't use the ws module. It uses the the native HTTP server and Deno.upgradeWebSocket()
How to use:
$ deno run -A new_server.ts
$ deno
// Open a connection -- Deno.upgradeWebSocket should take care of opening the socket connection
const w = new WebSocket("ws://localhost:1447");
// Send a message to the "test" channel
w.send(`{"channel":"test", "message": {"hello":"world"}}`);
// Close the client -- you should see logging that shows that the client was deleted from the clients map
w.close();
The new server in this PR uses all of the same logic that we currently use in the
server.ts
file. Only difference is it doesn't use thews
module. It uses the the native HTTP server andDeno.upgradeWebSocket()
How to use: