improvement websocket according to gorilla example
This commit is contained in:
@@ -20,6 +20,7 @@ func (d *DBMHandler) Set(req *json_dataModels.Request, id string) {
|
||||
|
||||
for _, set := range req.Set {
|
||||
dps := d.DBM.QueryDatapoints(1, set.Uuid, set.Path)
|
||||
|
||||
if len(dps) == 0 {
|
||||
resp.SetError()
|
||||
if resp.Message == "" {
|
||||
@@ -27,8 +28,10 @@ func (d *DBMHandler) Set(req *json_dataModels.Request, id string) {
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
for _, dp := range dps {
|
||||
dp.UpdateValue(d.Conns, set.Value)
|
||||
|
||||
resp.AddSet(json_dataModels.Set{
|
||||
Uuid: dp.Uuid,
|
||||
Path: dp.Path,
|
||||
@@ -36,6 +39,7 @@ func (d *DBMHandler) Set(req *json_dataModels.Request, id string) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||
d.Log.Error("get.Set", err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user