ing
This commit is contained in:
parent
c667559abc
commit
f205a2fcd8
7
Gopkg.lock
generated
7
Gopkg.lock
generated
|
@ -17,10 +17,11 @@
|
|||
branch = "master"
|
||||
name = "git.loafle.net/commons/rpc-go"
|
||||
packages = [
|
||||
"codec",
|
||||
"protocol",
|
||||
"protocol/json"
|
||||
]
|
||||
revision = "ded75d227c68b0d64ae4467613e5a3b790968328"
|
||||
revision = "b834f36e2bdb7e5ff93e83ab165ee0310895f6e7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -30,7 +31,7 @@
|
|||
"socket",
|
||||
"socket/web"
|
||||
]
|
||||
revision = "1c6419e15b8c2c9ca609d205bf907948a19c6f1d"
|
||||
revision = "20a63b3de6efdc0942bfb4be21ddc64e2b76f59d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -83,7 +84,7 @@
|
|||
"server",
|
||||
"servlet"
|
||||
]
|
||||
revision = "1db82cb967f26a4cb4031e9fd8efe13031d1793c"
|
||||
revision = "b7d6a6fcb39be4e5a376c6db4fd8fe7d6a2fe6bc"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
|
|
|
@ -6,15 +6,16 @@
|
|||
"concurrency": 262144,
|
||||
"keepAlive": 60,
|
||||
"handshakeTimeout": 60,
|
||||
"maxMessageSize": 16384,
|
||||
"readBufferSize": 16384,
|
||||
"writeBufferSize": 16384,
|
||||
"maxMessageSize": 8192,
|
||||
"readBufferSize": 8192,
|
||||
"writeBufferSize": 8192,
|
||||
"readTimeout": 0,
|
||||
"writeTimeout": 0,
|
||||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 10,
|
||||
"enableCompression": true
|
||||
"enableCompression": false,
|
||||
"compressionThreshold": 8192
|
||||
},
|
||||
"external": {
|
||||
"grpc": {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
crc "git.loafle.net/commons/rpc-go/codec"
|
||||
crpj "git.loafle.net/commons/rpc-go/protocol/json"
|
||||
csgw "git.loafle.net/commons/server-go/socket/web"
|
||||
"git.loafle.net/overflow/member_gateway_rpc/config"
|
||||
|
@ -8,13 +9,11 @@ import (
|
|||
)
|
||||
|
||||
func New(_config *config.Config) *csgw.Server {
|
||||
rpcServerCodec := crpj.NewServerCodec()
|
||||
|
||||
ws := &servlet.WebappServlets{
|
||||
VerifyKey: _config.VerifyKey,
|
||||
SignKey: _config.SignKey,
|
||||
}
|
||||
ws.RPCServerCodec = rpcServerCodec
|
||||
ws.RPCServerCodec = crpj.NewCustomServerCodec(crc.NewCompressionCodecSelector(_config.ServerHandler.GetCompressionThreshold()))
|
||||
ws.UseSession = true
|
||||
|
||||
sh := &ServerHandlers{
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"git.loafle.net/commons/logging-go"
|
||||
"git.loafle.net/commons/server-go"
|
||||
"git.loafle.net/commons/server-go/socket"
|
||||
css "git.loafle.net/commons/server-go/socket"
|
||||
oe "git.loafle.net/overflow/external-go"
|
||||
og "git.loafle.net/overflow/gateway"
|
||||
ogs "git.loafle.net/overflow/gateway/subscribe"
|
||||
|
@ -96,7 +96,7 @@ func (s *WebappServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.R
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *WebappServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
|
||||
func (s *WebappServlets) OnConnect(servletCtx server.ServletCtx, conn css.Conn) {
|
||||
s.RPCServlets.OnConnect(servletCtx, conn)
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ LOOP:
|
|||
for _, session := range sessions {
|
||||
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
|
||||
if nil != _writeChan {
|
||||
writeChan := _writeChan.(chan<- []byte)
|
||||
writeChan <- *msg.Message
|
||||
writeChan := _writeChan.(chan<- css.SocketMessage)
|
||||
writeChan <- css.MakeSocketMessage(css.TextMessage, *msg.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user