From 3b49522073dee95dd35cd26a31f254ec71cd1962 Mon Sep 17 00:00:00 2001 From: Jonas Schmid Date: Wed, 24 Nov 2021 09:34:36 +0100 Subject: [PATCH] Adapt ABORT message to comply with spec --- client/client.go | 2 +- router/realm.go | 2 +- router/router.go | 2 +- wamp/options.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/client.go b/client/client.go index 3b5cf544..dc8c47a2 100644 --- a/client/client.go +++ b/client/client.go @@ -820,7 +820,7 @@ func handleCRAuth(peer wamp.Peer, challenge *wamp.Challenge, authHandlers map[st // If router sent back ABORT in response to client's authentication attempt // return error. if abort, ok := msg.(*wamp.Abort); ok { - authErr, _ := wamp.AsString(abort.Details[wamp.OptError]) + authErr, _ := wamp.AsString(abort.Details[wamp.OptMessage]) if authErr == "" { authErr = "authentication failed" } diff --git a/router/realm.go b/router/realm.go index de3fc179..f8f7c4a0 100644 --- a/router/realm.go +++ b/router/realm.go @@ -405,7 +405,7 @@ func (r *realm) handleSession(sess *wamp.Session) error { if err != nil { abortMsg := wamp.Abort{ Reason: wamp.ErrProtocolViolation, - Details: wamp.Dict{"error": err.Error()}, + Details: wamp.Dict{wamp.OptMessage: err.Error()}, } r.log.Println("Aborting session", sess, ":", err) sess.TrySend(&abortMsg) diff --git a/router/router.go b/router/router.go index d8e49702..c904751b 100644 --- a/router/router.go +++ b/router/router.go @@ -132,7 +132,7 @@ func (r *router) AttachClient(client wamp.Peer, transportDetails wamp.Dict) erro abortMsg := wamp.Abort{Reason: reason} abortMsg.Details = wamp.Dict{} if abortErr != nil { - abortMsg.Details["error"] = abortErr.Error() + abortMsg.Details[wamp.OptMessage] = abortErr.Error() r.log.Println("Aborting client connection:", abortErr) } client.Send(&abortMsg) // Blocking OK; this is session goroutine. diff --git a/wamp/options.go b/wamp/options.go index 157a0e51..cb2aa8bd 100644 --- a/wamp/options.go +++ b/wamp/options.go @@ -6,10 +6,10 @@ const ( OptAcknowledge = "acknowledge" OptDiscloseCaller = "disclose_caller" OptDiscloseMe = "disclose_me" - OptError = "error" OptExcludeMe = "exclude_me" OptInvoke = "invoke" OptMatch = "match" + OptMessage = "message" OptMode = "mode" OptProcedure = "procedure" OptProgress = "progress"