ws only updates when cli executes
Closed this issue · 4 comments
I have a client listening to the websocket on ws://localhost/devices/0?levels=true
via /tmp/minidsp.sock
and a separate shell open
execution of minidsp
in the shell immediately produces {"master":{"preset":1,"source":"Usb","volume":-4.0,"mute":false}}
on the websocket
if I then do
$ minidsp -v gain -- -5
Sent: ReadHardwareId
Recv: HardwareId { payload: [01, 09, 0a] }
Sent: ReadMemory { addr: ffa1, size: 01 }
Recv: MemoryData(MemoryView { base: ffa1, data: [64] })
Sent: ReadMemory { addr: fffc, size: 02 }
Recv: MemoryData(MemoryView { base: fffc, data: [ff, ff] })
Sent: SetVolume { value: Gain(-5.0) }
Recv: Ack
nothing is received via the ws
then
$ minidsp
MasterStatus { preset: 1, source: Usb, volume: Gain(-5.0), mute: false, dirac: false }
Input levels: -131.4, -131.4
Output levels: -128.4, -128.4, -120.0, -128.4
shows the command was accepted and gain updated
and the ws receives
{"master":{"preset":1,"source":"Usb","volume":-5.0,"mute":false}}
so it seems like the ws is not updating as expected
Async status updates through websocket currently only reflect operations that were done through the device's IR remote, which, due to some protocol similarities, are also triggered by master status requests, causing this weird looking behaviour.
There will eventually be a way to get updates done by other minidsp-rs clients (including the official plugin app), but right now the command line tool bypasses the API and directly sends raw frames to the device, making it non-trivial to broadcast update operations to other clients.
This being said I can probably poll the device for changes once in a while, won't be truly async so I'd control it via another query string param