From 3bc9c095df7047a3a6ade733d117e733e2b72bc5 Mon Sep 17 00:00:00 2001 From: NoahLan <6995syu@163.com> Date: Mon, 10 Jul 2023 18:05:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=B8=B2=E5=8F=A3?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=B1=BB=E5=9E=8B=E5=8F=82=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connection/connection.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/connection/connection.go b/connection/connection.go index b2dd7db..fa0d846 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -34,8 +34,9 @@ const ( type ConnType int const ( - ConnTypeTCP ConnType = iota // TCP connection - ConnTypeWS // Websocket connection + ConnTypeTCP ConnType = iota // TCP connection + ConnTypeWS // Websocket connection + ConnTypeSerial // Websocket connection ) type ( @@ -102,9 +103,13 @@ func NewConnection( chSend: make(chan PendingMessage, 128), chWrite: make(chan []byte, 128), } - _, ok := conn.(*WSConn) - if ok { + if _, ok := conn.(*WSConn); ok { r.typ = ConnTypeWS + return r + } + if _, ok := conn.(*SerialConn); ok { + r.typ = ConnTypeSerial + return r } return r }