Buffer messages to wait for reconnect
Leaving for draft for now, want to double check all retention/removal stuff so there's no memory leak possibility.
Buffer up messages that would be sent to disconnected clients. On client reconnect (just "connect" server side still) check the buffer for the pid from the client and re-emit messages.
Only keep the messages in the buffer for a fixed amount of seconds (can adjust this maybe with config if needed? Or can use the same timeout as the UI maybe since the user would be prompted to try again anyways if they leave off into the wallet app too long)
Some details on Socket.io handling disconnections: https://socket.io/docs/v4/tutorial/handling-disconnections
Socket.io does have a built in Connection State Recovery: https://socket.io/docs/v4/connection-state-recovery I think this would accomplish what this code does here, however it's not implemented in the Python library VCAuth uses see: https://github.com/miguelgrinberg/python-socketio/issues/1258
Maybe we shouldn't be using this library? It's a pretty simple wrapper though but could be considerations on handling web sockets in a different way. We do however need to consider that storing in-memory is not what we want forever on VCAuth and need to be able to hook into (DB likely) persistence for multi-pod deployment. The code here should be able to handle that need when we address it.
Update the python socket library too (and other python libraries), and socket.io client JS.