DJ5CW's Ham Radio Stuff


All kinds of things too precious not to share, in short articles. Constantly under construction or destruction. Note that code snippets are usually working minimum examples (often stripped of extra features). If you plan to use and of the code for anything serious, you may want to contact me. It's likely that I can provide you with some updates and good (?) advice.

Fabian KurzHam RadioStuff

Websocket Gateway to a DX Cluster

While modernizing the FOC RBN web based telnet "client", which is nothing more than an iframe that loads a HTML page that consists of not much more than a <pre> tag followed by the telnet output, with an infinite timeout so that you actually see the spots in your browser more or less in real time, I decided it was time to have a look at websockets and to build a real web client that allows using a DX cluster interactively just like with a normal telnet client.

Thanks to my recent infatuation with the programming language Go, I picked its websocket server implementation to minimize the lines of code I have to write myself, and half an hour later, it was done: A full websocket to telnet bridge.

On the Go side, it simply calls a handler for each incoming websocket connection which in turn opens a socket to the DX cluster, and then dispatches the output of the cluster back to the websocket in a separate go routine, while reading user input from the websocket and redirecting it to the cluster.

On the HTML side it's a very simple HTML page that includes a little form with a textarea for the telnet output, an input line and a few lines of JavaScript to do the Websocket magic.

You can build some fancy stuff around it, buttons that trigger certain actions or some more JavaScript code that interprets the spots and does something more useful with them than just displaying them line by line... There are no limits to your imagination.

By the way, using mod_proxy_wstunnel you can easily hide the websocket server behind your Apache server, and also provide a secure websocket if your web server is already configured for it, at no extra cost.


Added: 21-Aug-2016. Last modified: 21-Aug-2016.

Fabian KurzHam RadioStuff