mirror of
https://github.com/netfun2000/rttys_zhaojh329.git
synced 2026-02-27 09:53:24 +08:00
broker.go: Use json-iterator/go instead of buger/jsonparser
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
@@ -21,8 +21,8 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/json-iterator/go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"time"
|
||||
)
|
||||
@@ -149,12 +149,12 @@ func (br *Broker) run() {
|
||||
devsid = data[0]
|
||||
data = data[1:]
|
||||
} else {
|
||||
typ, _ := jsonparser.GetString(data, "type")
|
||||
typ := jsoniter.Get(data, "type").ToString()
|
||||
if typ == "cmd" {
|
||||
handleCmdResp(data)
|
||||
continue
|
||||
}
|
||||
val, _ := jsonparser.GetInt(data, "sid")
|
||||
val := jsoniter.Get(data, "sid").ToInt()
|
||||
devsid = uint8(val)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user