|
|
@ -34,8 +34,9 @@ const (
|
|
|
|
type ConnType int
|
|
|
|
type ConnType int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
ConnTypeTCP ConnType = iota // TCP connection
|
|
|
|
ConnTypeTCP ConnType = iota // TCP connection
|
|
|
|
ConnTypeWS // Websocket connection
|
|
|
|
ConnTypeWS // Websocket connection
|
|
|
|
|
|
|
|
ConnTypeSerial // Websocket connection
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type (
|
|
|
|
type (
|
|
|
@ -102,9 +103,13 @@ func NewConnection(
|
|
|
|
chSend: make(chan PendingMessage, 128),
|
|
|
|
chSend: make(chan PendingMessage, 128),
|
|
|
|
chWrite: make(chan []byte, 128),
|
|
|
|
chWrite: make(chan []byte, 128),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_, ok := conn.(*WSConn)
|
|
|
|
if _, ok := conn.(*WSConn); ok {
|
|
|
|
if ok {
|
|
|
|
|
|
|
|
r.typ = ConnTypeWS
|
|
|
|
r.typ = ConnTypeWS
|
|
|
|
|
|
|
|
return r
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := conn.(*SerialConn); ok {
|
|
|
|
|
|
|
|
r.typ = ConnTypeSerial
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return r
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
}
|
|
|
|