dummy-controller
v1.0.0
Published
A dummy controller that mimics a garage door controller
Readme
This is a ws client that mimic a controller Another type of client is the web page that reads device status and send commands to controller (via server)
server is defined in ws.ts. Server's role includes
- connect/disconnect socket sessions to different clients
- manage channels
- relay messages
- sends type "metadata" on interval (see ws.ts, sendMetaData function)
Type of messages and their format that server sends is defined in grage-lib/lib.ts
- Channel messages, action: relay message to all clients on the channel. This includes 1.1 Data message 1.2 Ping 1.3 rping
- Connect messages, action: connect to the clients that are in channel message.id
- Data messages, relay
Channel structure There are "channels" on both ws server and client script grage.ts. They have different meanings
- In server (ws.ts), its structure looks like {id, socket[]} 1.1 each channel has an ID 1.2 each channel has an array of socket clients
- On client, channels is an array of listeners : {id, {listener1,listener2...}}
