photonvision icon indicating copy to clipboard operation
photonvision copied to clipboard

Make Client Side Websocket Requests Asynchronous

Open srimanachanta opened this issue 1 year ago • 2 comments

Currently, websocket changes sent from the UI to the backend are just assumed to be successful, instead, the backend should return a WebsocketReponse struct similar to an HTTP response. By doing this, we can make sure that websocket-based changes are suspenseful.

To implement this we need to make the backend echo back a WebsocketReponse object back to the UI which has an async promise waiting for this message. Multiple requests can be handled by including the request handler within the response so the promise can determine the intended response. Also means that the API for this can be abstracted well for both the frontend and backend.

srimanachanta avatar Aug 02 '24 18:08 srimanachanta

Mom can we have HTTP requests?

No, we have HTTP requests at home

HTTP at home:

mcm001 avatar Aug 02 '24 19:08 mcm001

I wonder if you could go into a bit more detail about what kind of improvements we'd see from this. Will this somehow communicate errors or just communicate the network delay to the user?

Alextopher avatar Aug 04 '24 02:08 Alextopher