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 }