I’m trying to allow one or more client devices (like tablets and phones) to connect to an ESP32 via a websocket, via wifi or BT, and then have the ESP32 stream data to the client in JSON.
From searching it seems that I do this using the RPC libraries, including one called rpc-ws which I can not find in the API documentation. Regardless, it seems that I have to create a callback and then use mg_rpc_send_responsef() from within the callback.
But this only seems to work if the client takes some action to poll the server. How can I cause the server to stream data to the clients? Would I just use a timer with a callback that calls mg_rpc_send_responsef() even if there is nothing from the client?
Is there an example? After searching I have not found much.