Hugo and websocket applications was ported from Drupal7 to Hugo. There were some vocabulary applications written in Flash (ActionScript), which communicate database via Drupal7 Service module. I rewrote them in HTML5 and Go. My steps:

(1) Wrote a vocabulary service (websocket) application in Go and make this application a linux service. This application listen only websocket port and returns vocabularies and some random words.

func main() {
        http.HandleFunc("/ws", wsHandle)
        http.ListenAndServe(":8888", nil)

(2) Setup nginx.conf (Here 8888 is the websocket port and closed to outside world. On the 80 port nginx serves Hugo site as usual)

server {
        listen        80;
        location /ws {

(3) Wrote the client side applications in Javascript using WebSockets.

var ws = new WebSocket("ws://" + + "/ws");

(4) In the Go application do the Origin check:

var upgrader = websocket.Upgrader{
        ReadBufferSize:  1024,
        WriteBufferSize: 1024,
        CheckOrigin: func(r *http.Request) bool {
                return r.Header["Origin"][0] == ""

(Here I need your tips to have a better check)

I use on three apps for now. Flashcards is one of them.