From 2a1554331a505af91272e774a394fb936fbba01c Mon Sep 17 00:00:00 2001 From: steden <1470804@qq.com> Date: Mon, 16 Sep 2024 18:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0ws=E7=9A=84=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- websocket/baseContext.go | 2 +- websocket/socketHandler.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/websocket/baseContext.go b/websocket/baseContext.go index 6f53c88..ab599dc 100644 --- a/websocket/baseContext.go +++ b/websocket/baseContext.go @@ -91,7 +91,7 @@ func (receiver *BaseContext) Send(msg any) error { var message string // 基础类型不需要进行序列化 if fastReflect.PointerOf(msg).Type == fastReflect.GoBasicType { - message = parse.ToString(message) + message = parse.ToString(msg) } else { // 其余类型,一律使用json marshal, _ := json.Marshal(msg) diff --git a/websocket/socketHandler.go b/websocket/socketHandler.go index 1914cc8..97b9458 100644 --- a/websocket/socketHandler.go +++ b/websocket/socketHandler.go @@ -17,7 +17,7 @@ func SocketHandler(route *context.HttpRoute) websocket.Handler { httpContext.SetWebsocket(conn) // 创建链路追踪上下文 - trackContext := container.Resolve[trace.IManager]().EntryWebSocket(httpContext.URI.Host, httpContext.URI.Url, httpContext.ContentType, httpContext.Header.ToMap(), httpContext.URI.GetRealIp()) + trackContext := container.Resolve[trace.IManager]().EntryWebSocket(httpContext.URI.Host, httpContext.URI.Url, httpContext.Header.ToMap(), httpContext.URI.GetRealIp()) trackContext.SetBody(httpContext.Request.BodyString, httpContext.Response.GetHttpCode(), string(httpContext.Response.BodyBytes)) trackContext.End(nil) //httpContext.Data.Set("Trace", trackContext)