This commit is contained in:
crusader 2018-04-10 12:58:53 +09:00
parent 366738c48d
commit 2d6345b493
2 changed files with 9 additions and 8 deletions

View File

@ -2,7 +2,7 @@
"serverHandler": { "serverHandler": {
"name": "Gateway WebApp", "name": "Gateway WebApp",
"network": "tcp4", "network": "tcp4",
"address": "192.168.1.103:19090", "address": "127.0.0.1:19090",
"concurrency": 262144, "concurrency": 262144,
"keepAlive": 60, "keepAlive": 60,
"handshakeTimeout": 60, "handshakeTimeout": 60,

View File

@ -97,7 +97,7 @@ func (s *WebappServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.R
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
// Don't forget to validate the alg is what you expect: // Don't forget to validate the alg is what you expect:
if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {
return nil, fmt.Errorf("Webapp: Unexpected signing method: %v", token.Header["alg"]) return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"])
} }
// hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key") // hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key")
return verifyKey, nil return verifyKey, nil
@ -157,7 +157,7 @@ func (s *WebappServlets) handleSubscribe(serverCtx server.ServerCtx, subscribeCh
} }
for _, _connection := range _connections { for _, _connection := range _connections {
_writeChan := _connection.servletCtx.GetAttribute(og.SessionWriterChanKey) _writeChan := _connection.servletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan { if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte) writeChan := _writeChan.(chan<- []byte)
writeChan <- msg.Message writeChan <- msg.Message
@ -165,21 +165,22 @@ func (s *WebappServlets) handleSubscribe(serverCtx server.ServerCtx, subscribeCh
} }
} }
case oos.MEMBER_SESSION: case ogs.MEMBER_SESSION:
for _, sessionID := range message.Targets { for _, sessionID := range msg.Targets {
_connection, ok := s.connections.Load(sessionID) __connection, ok := s.connections.Load(sessionID)
if !ok { if !ok {
logging.Logger().Debugf("Client[%s] is not exist", sessionID) logging.Logger().Debugf("Client[%s] is not exist", sessionID)
break break
} }
_writeChan := _connection.servletCtx.GetAttribute(og.SessionWriterChanKey) _connection := __connection.(*connection)
_writeChan := _connection.servletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan { if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte) writeChan := _writeChan.(chan<- []byte)
writeChan <- msg.Message writeChan <- msg.Message
} }
} }
default: default:
logging.Logger().Warnf("Subscriber: Unknown TargetType %s", message.TargetType) logging.Logger().Warnf("Subscriber: Unknown TargetType %s", msg.TargetType)
} }
} }
} }