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