From 634ccd50a99d1510037cf3f61686e6abebe5a562 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 30 Dec 2015 15:21:09 +0100 Subject: implemented cancel command diff --git a/src/helsinki.at/rhimportd/ctrlWebSocket.go b/src/helsinki.at/rhimportd/ctrlWebSocket.go index 1e8cfff..df58f3f 100644 --- a/src/helsinki.at/rhimportd/ctrlWebSocket.go +++ b/src/helsinki.at/rhimportd/ctrlWebSocket.go @@ -183,6 +183,12 @@ func webSocketSessionHandler(reqchan <-chan webSocketRequestData, ws *websocket. } else { sendWebSocketResponse(ws, &webSocketResponseData{ResponseCode: code, Type: "ACK", Id: session.id}) } + case "cancel": + if session.id == "" { + sendWebSocketErrorResponse(ws, "", http.StatusBadRequest, "This connection doesn't handle any session") + return + } + session.session.Cancel() case "reconnect": if session.id != "" { sendWebSocketErrorResponse(ws, "", http.StatusBadRequest, "This connection already handles a session") diff --git a/test/socket.html b/test/socket.html index e2f7b85..d038527 100644 --- a/test/socket.html +++ b/test/socket.html @@ -19,9 +19,10 @@ + + function cancel() { + s.cancel(); + } + - +

Radio Helsinki Rivendell Importer:

+ +
- -- cgit v0.10.2