redis pub/sub with websockets - part VI
Date: 2021-02-18
Author: Andrew
Continued building out the redis pub/sub arrangement with all the services. Did find a couple of errors that were breaking things - such as that I had published to br-pi-stats for the os and beach bot version numbers and the listener was subscribed to br_pi_stats - so that was never going to work.
Got the OS and version info in place and had it published after the server, websocket and listener were up an running. So moving along nicely.
To keep things light at the front end I started modifying the javascript that parses the message from the server and updates the webpage. This meant building something that the key in the JSON needs to match the web page id tag. Plus I now need to cater for JSON information of varying lengths. For example the status JSON message has four fields, the stats JSON message has two.
This is where I stalled for the day. Could not for the life of me get the forEach statement to work! Very frustrating - should be dead easy. Now I admit it's probably "user-error" but I looked up example after example and they all said pretty much the same thing on how to construct the statement. Would it work? No. In end ran out of time in the day... might be a few days before I can get back to it :(