voorkant / voorkant-core

https://voorkant.org/
MIT License
2 stars 3 forks source link

Backend/WSConn: implement send-and-wait for doCommand #79

Closed Habbie closed 5 months ago

Habbie commented 5 months ago

fixes #78

this will need refactoring (perhaps after merge); I suspect we want to make WSConn much more JSON-aware?

cyclops1982 commented 5 months ago

This works fine on my environment.

I think we should move get_services/get_states out of threadrunner and use the sendAndWait() for that too. Then threadrunner should maybe just do the subscribe stuff?

Habbie commented 5 months ago

I think we should move get_services/get_states out of threadrunner and use the sendAndWait() for that too. Then threadrunner should maybe just do the subscribe stuff?

One downside would be waiting for latency for each of them, while currently we fire them off in parallel. I'm not sure this matters much though.

Another important refactor is that WSConn now gives string to Backend, and Backend then sometimes gives json back to WSConn because WSConn knows who is waiting for something. I suspect switching WSConn to json itself will simplify things.

However, none of these things need to happen in this PR, I think

cyclops1982 commented 5 months ago

I agree, the PR can go in and i also think that get_Services/get_states change is an optimization that is not needed.

I agree that it's cleaner to move wsconn to just talk JSON.