At least in one case where I've made a client server app, it was easier for me to open a websocket and use the webserver as a place to run functions and return ok/err. I found it much easier to work with than requests to endpoints.
I rolled my own message format, but JSON-RPC would have done well too.