So I had some time to play with this some more over the weekend, and I have a little proof of concept demo app running to control the SparkSDR receivers. I had some time to think a little bit more of what the websocket protocol would look like, and with some trial and error this is what I have been using.
Made it with the idea in mind that you should not need the original request to act on any replies from the server. Its still probably very far from perfect, but so far its been working pretty well.
Connected to wss://
rig.kk4wjs.com/ws<< {"cmd":"getReceivers","receiver":null}
>> {"receiver":null,"response":{"ReceiverList":[{"id":0,"frequency":3573000,"mode":"FT8"},{"id":1,"frequency":7074000,"mode":"FT8"},{"id":2,"frequency":14074000,"mode":"FT8"},{"id":3,"frequency":10140000,"mode":"FT8"},{"id":4,"frequency":3580000,"mode":"PSK"},{"id":5,"frequency":7070000,"mode":"PSK"},{"id":6,"frequency":14070000,"mode":"PSK"},{"id":7,"frequency":10141000,"mode":"PSK"},{"id":8,"frequency":3575000,"mode":"FT4"},{"id":9,"frequency":7047500,"mode":"FT4"},{"id":10,"frequency":14080000,"mode":"FT4"},{"id":11,"frequency":10140000,"mode":"FT4"}]}}
<< {"cmd":{"setFrequency":7069000},"receiver":5}
>> {"receiver":5,"response":{"FrequencyResponse":{"frequency":7069000,"vfo":""}}}
<< {"cmd":{"setFrequency":7070000},"receiver":5}
>> {"receiver":5,"response":{"FrequencyResponse":{"frequency":7070000,"vfo":""}}}
<< {"cmd":{"setMode":"NFM"},"receiver":5}
>> {"receiver":5,"response":{"ModeResponse":{"mode":"NFM","width":16000}}}
<< {"cmd":{"setMode":"PSK"},"receiver":5}
>> {"receiver":5,"response":{"ModeResponse":{"mode":"PSK","width":3000}}}
```
My next goal is to try and get audio from portaudio through a binary channel in the websocket.