Running KiwiSDR from a headless browser

Chrome (and probably other browsers) can now be run headless. That is, they can be run from the command line without showing the actual browser. This saves a lot of resources needed to paint and update the display. It also means you can listen to a KiwiSDR in the background witihout fearing accidentally closing the browser window while doing something else.

Why would I want to do this?

1. I can just listen to a radio station with no visible open browser.

2. I can open up to 4 WSPR extensions to report reception with no open browser.

To use KiwiSDR in a headless browser requires entering a command line. I use a batch file to save typing or copying the command.

First you need to locate the chrome.exe file on your system. Everything makes that very easy. https://www.voidtools.com/

The command line I use is to listen to 740 AM on my own Kiwi is:

"C:\Users\Peter\AppData\Local\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --remote-debugging-port=9222 "http://kiwisdr.ve3sun.com:8073/?f=740.00amnz10"

The first part is the location of the chrome.exe file. Yours will definitely be different.

--headless - run without showing the browser (as a background process)
--disable-gpu - necessary due to bugs that haven't been fixed yet 
--remote-debugging-port=9222 -  the port to use to make changes such as tuning to a different frequency, etc.
"http://kiwisdr.ve3sun.com:8073/?f=740.00amnz10" - the complete URL you would use in a normal browser.


The command line I use to monitor 2 WSPR frequencies is:

"C:\Users\Peter\AppData\Local\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --remote-debugging-port=9223 "http://kiwisdr.ve3sun.com:8073/?ext=wspr,20m&mute&win2&ext=wspr,40m&mute"

To access the debugger window, which can show the user interface, just enter http://localhost:9222 into your usual browser.

9222 is the default port. If you are opening more than one instance of chrome, you have to use different ports for each.

How to stop a headless browser?

It seems once the process has started, the usual ctl-C and ctl-Break don't work to stop it. Even closing the cmd window doesn't make a difference.

So I use ProcessExplorer (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer) which shows the command line used to start each process. Task Manager used to do that but if it still does, I couldn't find it.

Otherwise, you have to stop all the chrome.exe processes, which can be many.

Linux and Mac users should be able to do all this with equivalent methods.

I hope others find this useful.


- Peter

Comments

  • Hi Peter,

    I also think a headless mode would be useful, but what you are describing seems a bit messy / complicated.

    Wouldn't it be easier to simply use kiwirecorder and loop the record file to playback and gradually overwrite it as it's being recorded, so that you don't end up with a massive file (set the max file size) ?

    This would also allow you to 'wind back time' if you wanted to listen to a brief transmission that you missed.

    I think a platform independent application using something like python (or maybe even QT) and running the KWi in headless mode would be a useful addition to a browser based interface. It would also allow some of the other automation (emulation of a 'real radio' for software control by  HRD / PC ALE and others) that has been previously discussed to be brought to fruition more easily. 

    I think this is a bit like the Spyserver mode that can be used for remote reception with SDR Sharp.

    If you want to see something like what I'm describing, try running the most recent version of SDR Sharp and select spyserver as the source. Then enter one of the following addresses into the url box inside the source window. If there is only a single user full control is possible, but if you are the second user you may be limited to the frequency range you can use.

    sdr://g8jnj.zapto.org:5556

    RTL SDR V3 in direct sampling mode 0-14.4MHz (Spyserver 1624) using whatever antenna is currently selected on my KiWi WEB SDR http://southwest.ddns.net:8073/

    sdr://g8jnj.zapto.org:5557

    RTL SDR V3 in direct sampling mode 14.4-30MHz (Spyserver 1624) using whatever antenna is currently selected on my KiWi WEB SDR http://southwest.ddns.net:8073/
     
    sdr://g8jnj.zapto.org:5558

    Airspy R1 100-500MHz using VHF /UHF white stick collinear

    Regards,

    Martin - G8JNJ









  • Peter,
    I have been working this out with Firefox in headless mode. The debug control takes developer tools. https://developer.mozilla.org/en-US/docs/Tools  I have not installed them or tried them yet. The command line syntax is different, but the functions seem to be the same for the most part. Command line options are listed here. https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options

    Currently I'm uploading spots using this command line syntax from Linux on my Chromebook.
    (trusty)ron@localhost:~$ firefox/firefox -headless -new-tab "http://ka7u.no-ip.org:8074/?ext=wspr,mf&mute" -new-tab "http://ka7u.no-ip.org:8074/?ext=wspr,40m&mute"
    *** You are running in headless mode.

    As you can see it takes more command input than the Chrome commands, but it works fine. I checked and the spots are uploading for MF and 40M. It is running in the background and a CTRL-C from the command line kills the process.

    Thanks for showing how to do this.
    Ron
    KA7U
    VE3SUN
Sign In or Register to comment.