From f894837cd19904a6356457ef86f21bfdc5386984 Mon Sep 17 00:00:00 2001 From: Christian Loelkes Date: Sun, 27 Dec 2020 12:19:13 +0100 Subject: [PATCH 1/2] handle error message from server --- src/client/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/main.go b/src/client/main.go index 9dcb691..f774bd1 100644 --- a/src/client/main.go +++ b/src/client/main.go @@ -209,6 +209,9 @@ func (c *SignalingClient) processMessage(message *signaling.ServerMessage) { case "bye": log.Printf("Received bye: %+v\n", message.Bye) c.Close() + case "error": + log.Printf("Received error: %+v\n", message.Error) + c.Close() default: log.Printf("Unsupported message type: %+v\n", *message) } From 4af4a47ffd926b885df3f1ebfb949a7f7fe61b0b Mon Sep 17 00:00:00 2001 From: Christian Loelkes Date: Sun, 27 Dec 2020 12:56:18 +0100 Subject: [PATCH 2/2] fix incorrect OCS response from auth backend For compliance with the OCS standard, the OCS response structure MUST be {ocs: {meta:{...}, data: {...}}}. Until now the temporary auth backend from the client only responded with the data and triggered an 'Incomplete OCS response' from the signaling server. --- src/client/main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/client/main.go b/src/client/main.go index f774bd1..e1c821d 100644 --- a/src/client/main.go +++ b/src/client/main.go @@ -456,9 +456,22 @@ func registerAuthHandler(router *mux.Router) { return } + rawdata := json.RawMessage(data) + payload := &signaling.OcsResponse{ + Ocs: &signaling.OcsBody{ + Data: &rawdata, + }, + } + + jsonpayload, err := payload.MarshalJSON() + if err != nil { + log.Println(err) + return + } + w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - w.Write(data) + w.Write(jsonpayload) }) }