Howto "ping-pong" between SWI Prolog and Erlang using websocket

I’ve put some notes up on github which I wrote as a I figured out the websocket libraries in SWI Prolog and Erlang respectively. It’s the fairly dull “ping-pong” messaging program from Erlang’s introductory tutorial, redone using a third-party Erlang http client, Gun, and SWI Prolog.

But it illustrates the basics of using websocket with SWI Prolog quite well I think. I had no prior experience with websocket, so did things very slowly, step-by-step. Mercifully, I found it quite easy once I got the gist of it.

As always, suggestions, errors etc gratefully received.

I’m hoping to move on to a more advanced example of a web-based query interface, using Javascript’s websocket library, which I haven’t looked at yet.