jks
About
- Username
- jks
- Joined
- Visits
- 29,905
- Last Active
- Roles
- Member, Administrator, Moderator
- Points
- 206
- Location
- Tauranga, New Zealand RF82ci
- Callsign
- ZL4VO/KF6VO
- Additional information
- KiwiSDR support email: support@kiwisdr.com
Reactions
-
About Python KiwiClient [Kiwi API question]
The Kiwi protocol requires the client to send "keep alive" messages at least once every 60 seconds. Otherwise it is assumed the client (Javascript in the browser usually) isn't really running even if the web socket connection is still open for some reason. This had to be done in order to prevent connections from remaining open for long periods of time even through no one was really there. If no keep alive is received the connection is closed.
I don't know if it helps, but I was able to make web socket connections and send Kiwi commands and receive Kiwi sound and waterfall binary data using a program called
websocat
(web socket concatenate). See: https://github.com/vi/websocat There are binaries available for Windows, Linux and Mac and I was able to run the Mac one without problems.So, to connect to a Kiwi and get sound data do something like this from the Mac command line:
cat snd.ws.txt | websocat_mac -n ws://my_kiwi:8073/12345678/SND
Where
my_kiwi
is the name of the Kiwi and the filesnd.ws.txt
contains these commands to send to the Kiwi:SET auth t=kiwi p=
SET AR OK in=12000 out=44100
SET squelch=0 max=0
SET genattn=0
SET gen=0 mix=-1
SET ident_user=kiwirecorder.py
SET mod=am low_cut=-5000 high_cut=5000 freq=7550.000
SET agc=1 hang=0 thresh=-100 slope=6 decay=1000 manGain=50
SET keepalive
12345678
is a number and needs to be unique for each connection (hence a timestamp in msec). Thewebsocat -n
argument keeps the connection to the Kiwi open after all the commands in the file are sent. But note the connection will still close because additionalSET keepalive
commands are not being periodically sent.What you will receive from the Kiwi will be a combination of messages and data looking something like this:
MSG client_public_ip=[your public ip address as seen by the Kiwi]
MSG rx_chans=4
MSG chan_no_pwd=0
MSG chan_no_pwd_true=0
MSG is_local=0,1
MSG max_camp=4
MSG badp=0
MSG version_maj=1 version_min=447
MSG load_cfg= (large amount of configuration data omitted)
MSG center_freq=15000000 bandwidth=30000000 adc_clk_nom=66666600
MSG audio_init=1 audio_rate=12000 sample_rate=12001.062106
MSG stats_cb={"ct":4633,"ce":0,"cf":1000,"cc":0,"cu":[51],"cs":[49],"ci":[0],"ac":0,"wc":0,"fc":0,"ah":0,"as":0,"sr":12001.062106,"ga":0,"gt":0,"gg":0,"gf":0,"gc":66.665900,"go":0,"gr":"RF82ci","ad":0,"au":0,"ae":0,"ar":0,"an":4,"an2":32,"ap":[0,7439,0,0],"ai":[0,2121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sa":9,"sh":9,"tu":"04:04","tl":"17:04","ti":"NZDT","tn":"Pacific%5c%2fAuckland"}
SND [binary sound data]
SND [binary sound data]
...
You can do something similar for the waterfall with the command line:
cat wf.ws.txt | websocat_mac -n ws://my_kiwi:8073/12345678/W/F
And the
wf.ws.txt
file:SET auth t=kiwi p=
SET zoom=0 cf=7550.000000
SET maxdb=-10 mindb=-110
SET wf_comp=0
SET wf_speed=1
SET ident_user=kiwirecorder.py
SET keepalive
And you'll receive the waterfall data:
MSG rx_chans=4
MSG chan_no_pwd=0
MSG chan_no_pwd_true=0
MSG max_camp=4
MSG badp=0
MSG version_maj=1 version_min=447
MSG center_freq=15000000 bandwidth=30000000 adc_clk_nom=66666600
MSG kiwi_up=1 rx_chan=0
MSG extint_list_json=%5b%22colormap%22,%22cw_decoder%22,%22devl%22,%22DRM%22,%22fax%22,%22FFT%22,%22fsk%22,%22IBP_scan%22,%22iframe%22,%22iq_display%22,%22loran_c%22,%22navtex%22,%22noise_blank%22,%22noise_filter%22,%22sig_gen%22,%22S_meter%22,%22SSTV%22,%22TDoA%22,%22timecode%22,%22wspr%22%5d
MSG wf_fft_size=1024 wf_fps=23 wf_fps_max=23 zoom_max=14 rx_chans=4 wf_chans=4 wf_chans_real=4 wf_setup
MSG zoom=0 start=0
MSG wf_fps=1
MSG request_dx_update
W/F [binary waterfall data]
W/F [binary waterfall data]
...
This discussion is not complete because we need to talk about the parameters for the various
SET
commands and also the content of the returned binary data. These details are all handled by the kiwiclient / kiwirecorder Python code and that's why you should really try and make an effort to understand it. -
v1.446/445/444
From the CHANGE_LOG file. Not a lot new here. Except for days of tedious checking for memory errors (buffer overruns) and memory leaks to rule out a possible cause of the Windows 10 audio problems.
v1.446 March 28, 2021
WSPR extension:
By request: Added 6 & 13 MHz ISM bands (UK balloon-mobile operation).
Can restart autorun decoders via an admin page button instead of server restart.
Windows 10 audio "popping" problem:
Looked for memory addressing errors and leaks with the Clang address sanitizer.
A few minor issues fixed but nothing that changes the audio problem.
This was expected, but also had to be ruled out.
v1.445 March 24, 2021
SNR measurement:
Take transverter frequency offset into account.
Display SNR value(s) on user (top bar) and admin pages (status tab).
Added SAM PLL loop control to audio tab.
Has a slow loop setting "DX" that can be used to better track weak stations.
v1.444 March 23, 2021
Include two most recent SNR values in /status query. This implies all the SNR values
for public Kiwis will be aggregated in the rx.kiwisdr.com/index.html file
HTML comments.
TDoA extension:
Improved help panel contents.
Added warning against prematurely using too many sampling stations because of
the large number of computation timeouts we see on the server.
-
v1.443: automatic SNR measurement, queue/camp panel reload button, misc fixes
From the CHANGE_LOG file:
v1.443 March 22, 2021
Added automatic SNR measurement:
Every 6 hours (4 times daily) a Kiwi will connect to a free channel (if available)
and measure its own SNR. These results are available in JSON format from the
URL: my_kiwi:8073/snr (adjust Kiwi name and port number as required).
This URL is publicly accesible. Disable on the admin page, control tab if you
don't want to share this information.
The measurement details can be easily changed. Suggestions welcome.
SNR is currently defined in the same way as used by the sites snr.kiwisdr.com
and snr2.kiwisdr.com, i.e. waterfall dBm values, sorted, noise = 50th percentile
value (median), signal = 95th percentile value, SNR = signal - noise.
Two measurement bands are recorded: 0-30 MHz and 1.8-30 MHz in an attempt to
filter out the AM BCB. The JSON data also contains min/max dBm values and a
timestamp (local time unless the "UTC" value is set).
Added "reload page" button to queueing panel ("camp" parameter is removed from URL)
Use to quickly access any Kiwi redirection that might be available.
Autoscale button and aperture auto mode now disregard masked areas from calculations.
Admin page UI changes:
GPS RSSI now red color for sats not actually acquired (i.e. no subframe decoding)
Registration now requires a valid location field (for benefit of map.kiwisdr.com)
-
v1.441: camping fixes, AGC CW threshold, audio FFT extension fixes, misc fixes
From the CHANGE_LOG file:
v1.441 March 15, 2021
Audio camping bug fixes:
URL redirect now respects URL camp parameter. More work needed for other cases.
Audio now plays on Safari.
Added separate CW AGC threshold control.
Typically a lower AGC threshold is required for very narrow passband settings to
avoid low sensitivity. Since narrow passbands are most often associated with the
CW/CWN modes it was decided to add a separate AGC threshold control active only in
those modes. The original threshold control applies to all other modes.
The two are stored in their own separate browser cookies.
Fixed bugs in the Audio FFT display (the one that appears in 8-channel mode when more
than two channels are busy, or if the URL "no_wf" parameter is given):
The LSB passband is drawn in the same place as the actual FTT output.
The FFT display bins were flipped to be correct (i.e. low vs high frequency).
Autoscale mode works better than before.
Disabled compression ("comp") button in DRM/SAS/QAM modes since it has no meaning
and effect in these modes.
Fixed shift-click in SWBC bands not selecting nearest 5 kHz boundary.
Fix long audio latency on browsers that display "Click to start OpenWebRX" overlay.
-
v1.440: C-QUAM & channel queueing/camping
From the CHANGE_LOG file:
v1.439,440 March 14, 2021
Channel queuing and camping:
When all the Kiwi channels are busy(*) it is now possible to enter a queue to wait
for the next available channel. The queue is FIFO and multiple parties can
occupy the queue (your queue order will be shown).
If all channels are busy you can also now "camp" on an existing connection and
hear the audio of that channel. The only adjustment is to change the audio volume.
Otherwise you experience all the changes performed by the owner of the channel
(tuning, mode, etc).
You can also be in the queue waiting for your own channel while camping.
It is possible to use camping even if free channels are available by connecting
using the URL parameter "camp", e.g. my_kiwi:8073/?camp
You might want to do this if you know there is already a connection you want to
camp on, but there are also free channels you don't want to unnecessarily occupy.
In theory camping requires only slightly more resources because the audio stream
is simply being duplicated and sent to the camper's network connection.
The Kiwi admin can configure the maximum number of campers allowed, including zero.
Later on we can look at adding audio-related features to camping that only require
browser/javascript resources, hence place no additional load on the Kiwi server
(e.g. S-meter, recording, audio FFT waterfall/spectrum display).
These changes are complex and will no doubt have bugs and corner cases to fix.
(*) or unavailable due to password protection on those Kiwis that have split
public/private channels.
Added C-QUAM AM stereo mode to SAM mode button which now cycles as: SAM/SAL/SAU/SAS/QAM
Based on the work of Github user MaPePeR, see: github.com/jks-prv/Beagle_SDR_GPS/issues/395
Remember that alt-click will toggle the mode buttons backwards, e.g.
alt-click on SAM wraps back to QAM (faster than clicking forward on SAM 4 times).
The same applies to the keyboard shortcut: shift-A is SAM mode forward to SAL
alt-shift-A is SAM backward to QAM.
Apply ITU region selection to band display (e.g. 40m ham band now stops at 7.2M for R1)
It is possible this change will cause problems if extensive customization of
the kiwi.config/config.js file has been made by the user. Please let us know if
this happens to you.