ing
This commit is contained in:
parent
eccc5a4eec
commit
8436eb6f61
24
Gopkg.lock
generated
24
Gopkg.lock
generated
|
@ -18,12 +18,12 @@
|
||||||
name = "git.loafle.net/commons/server-go"
|
name = "git.loafle.net/commons/server-go"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"client",
|
|
||||||
"socket",
|
"socket",
|
||||||
|
"socket/client",
|
||||||
"socket/web",
|
"socket/web",
|
||||||
"socket/web/client"
|
"socket/web/client"
|
||||||
]
|
]
|
||||||
revision = "1cae23cf7819d56fd399346a1dc30af6a82d1a93"
|
revision = "20a63b3de6efdc0942bfb4be21ddc64e2b76f59d"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "git.loafle.net/overflow/gateway_rpc"
|
name = "git.loafle.net/overflow/gateway_rpc"
|
||||||
packages = ["server"]
|
packages = ["server"]
|
||||||
revision = "1db82cb967f26a4cb4031e9fd8efe13031d1793c"
|
revision = "b7d6a6fcb39be4e5a376c6db4fd8fe7d6a2fe6bc"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/BurntSushi/toml"
|
name = "github.com/BurntSushi/toml"
|
||||||
|
@ -108,8 +108,8 @@
|
||||||
"models",
|
"models",
|
||||||
"pkg/escape"
|
"pkg/escape"
|
||||||
]
|
]
|
||||||
revision = "89e084a80fb1e0bf5e7d38038e3367f821fdf3d7"
|
revision = "4e4e00bc5ab85a3ff5e988c91020cf0399a87026"
|
||||||
version = "v1.5.3"
|
version = "v1.5.4"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/klauspost/compress"
|
name = "github.com/klauspost/compress"
|
||||||
|
@ -118,8 +118,8 @@
|
||||||
"gzip",
|
"gzip",
|
||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
revision = "6c8db69c4b49dd4df1fff66996cf556176d0b9bf"
|
revision = "5fb1f31b0a61e9858f12f39266e059848a5f1cea"
|
||||||
version = "v1.2.1"
|
version = "v1.3.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/klauspost/cpuid"
|
name = "github.com/klauspost/cpuid"
|
||||||
|
@ -127,12 +127,6 @@
|
||||||
revision = "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da"
|
revision = "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da"
|
||||||
version = "v1.1"
|
version = "v1.1"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/klauspost/crc32"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "cb6bfca970f6908083f26f39a79009d608efd5cd"
|
|
||||||
version = "v1.1"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/segmentio/kafka-go"
|
name = "github.com/segmentio/kafka-go"
|
||||||
|
@ -185,7 +179,7 @@
|
||||||
"internal/timeseries",
|
"internal/timeseries",
|
||||||
"trace"
|
"trace"
|
||||||
]
|
]
|
||||||
revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196"
|
revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "golang.org/x/text"
|
name = "golang.org/x/text"
|
||||||
|
@ -212,7 +206,7 @@
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "google.golang.org/genproto"
|
name = "google.golang.org/genproto"
|
||||||
packages = ["googleapis/rpc/status"]
|
packages = ["googleapis/rpc/status"]
|
||||||
revision = "32ee49c4dd805befd833990acba36cb75042378c"
|
revision = "ff3583edef7de132f219f0efc00e097cabcc0ec0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "google.golang.org/grpc"
|
name = "google.golang.org/grpc"
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
"pongTimeout": 60,
|
"pongTimeout": 60,
|
||||||
"pingTimeout": 10,
|
"pingTimeout": 10,
|
||||||
"pingPeriod": 9,
|
"pingPeriod": 9,
|
||||||
"enableCompression": false
|
"enableCompression": false,
|
||||||
|
"compressionThreshold": 8192
|
||||||
},
|
},
|
||||||
"external": {
|
"external": {
|
||||||
"grpc": {
|
"grpc": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
logging "git.loafle.net/commons/logging-go"
|
logging "git.loafle.net/commons/logging-go"
|
||||||
"git.loafle.net/commons/server-go"
|
"git.loafle.net/commons/server-go"
|
||||||
"git.loafle.net/commons/server-go/socket"
|
css "git.loafle.net/commons/server-go/socket"
|
||||||
cssw "git.loafle.net/commons/server-go/socket/web"
|
cssw "git.loafle.net/commons/server-go/socket/web"
|
||||||
occp "git.loafle.net/overflow/commons-go/config/probe"
|
occp "git.loafle.net/overflow/commons-go/config/probe"
|
||||||
ocmd "git.loafle.net/overflow/commons-go/model/data"
|
ocmd "git.loafle.net/overflow/commons-go/model/data"
|
||||||
|
@ -88,7 +88,7 @@ func (s *DataServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
|
func (s *DataServlets) OnConnect(servletCtx server.ServletCtx, conn css.Conn) {
|
||||||
s.Servlets.OnConnect(servletCtx, conn)
|
s.Servlets.OnConnect(servletCtx, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,30 +98,34 @@ func (s *DataServlets) OnDisconnect(servletCtx server.ServletCtx) {
|
||||||
|
|
||||||
func (s *DataServlets) Handle(servletCtx server.ServletCtx,
|
func (s *DataServlets) Handle(servletCtx server.ServletCtx,
|
||||||
stopChan <-chan struct{}, doneChan chan<- struct{},
|
stopChan <-chan struct{}, doneChan chan<- struct{},
|
||||||
readChan <-chan []byte, writeChan chan<- []byte) {
|
readChan <-chan css.SocketMessage, writeChan chan<- css.SocketMessage) {
|
||||||
defer func() {
|
defer func() {
|
||||||
doneChan <- struct{}{}
|
doneChan <- struct{}{}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
err error
|
// messageType int
|
||||||
|
message []byte
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case msg, ok := <-readChan:
|
case socketMessage, ok := <-readChan:
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, message = socketMessage()
|
||||||
|
|
||||||
m := &ocmd.Metric{}
|
m := &ocmd.Metric{}
|
||||||
err = json.Unmarshal(msg, m)
|
err = json.Unmarshal(message, m)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
err = oek.Write("metric", []byte(m.SensorConfigID), msg)
|
err = oek.Write("metric", []byte(m.SensorConfigID), message)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue
Block a user