~pepe/trevor

Sockets handler for the Chidi
Protect handshake
Fix key extraction
Fix empty handshake request

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~pepe/trevor
read/write
git@git.sr.ht:~pepe/trevor

You can also use your local clone with git send-email.

#trevor

Websockets library for the Good Place.

This library defines on-connection function, that can be used with Chidi server start function as the last optional argument.

handler for on-connection function expects is not a function, but the table with :connect and :read methods, which are called on Websocket connection and and when new message appears, respectively. When connected handler table is enriched with the :write method so it can write to the connection.

For independent writting to the Websocket, the best way is to save the handler from the :connect and call it independently.

Usage is backed by the ev same as for the Chidi.

Basic example with saving the writers and periodic messaging, can be good overview of the workings.