|
|
|
@ -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
|
|
|
|
|
}
|
|
|
|
|