Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Added - Additional logging format option for Stackdriver Logging. - New runtime function to immediately disconnect active sockets. - New runtime function to kick arbitrary presences from streams. ### Fixed - Correctly return group user results in Lua runtime listing operation. Loading main.go +3 −2 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ func main() { // Start up server components. matchmaker := server.NewLocalMatchmaker(startupLogger, config.GetName()) sessionRegistry := server.NewSessionRegistry() sessionRegistry := server.NewLocalSessionRegistry() tracker := server.StartLocalTracker(logger, config, sessionRegistry, jsonpbMarshaler) router := server.NewLocalMessageRouter(sessionRegistry, tracker, jsonpbMarshaler) leaderboardCache := server.NewLocalLeaderboardCache(logger, startupLogger, db) Loading @@ -107,7 +107,8 @@ func main() { matchRegistry := server.NewLocalMatchRegistry(logger, startupLogger, config, tracker, router, config.GetName()) tracker.SetMatchJoinListener(matchRegistry.Join) tracker.SetMatchLeaveListener(matchRegistry.Leave) runtime, err := server.NewRuntime(logger, startupLogger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, matchRegistry, tracker, router) streamManager := server.NewLocalStreamManager(config, sessionRegistry, tracker) runtime, err := server.NewRuntime(logger, startupLogger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, matchRegistry, tracker, streamManager, router) if err != nil { startupLogger.Fatal("Failed initializing runtime modules", zap.Error(err)) } Loading runtime/runtime.go +5 −2 Original line number Diff line number Diff line Loading @@ -757,10 +757,13 @@ type NakamaModule interface { StreamUserJoin(mode uint8, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error) StreamUserUpdate(mode uint8, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error StreamUserLeave(mode uint8, subject, subcontext, label, userID, sessionID string) error StreamUserKick(mode uint8, subject, subcontext, label string, presence Presence) error StreamCount(mode uint8, subject, subcontext, label string) (int, error) StreamClose(mode uint8, subject, subcontext, label string) error StreamSend(mode uint8, subject, subcontext, label, data string) error StreamSendRaw(mode uint8, subject, subcontext, label string, msg *rtapi.Envelope) error StreamSend(mode uint8, subject, subcontext, label, data string, presences []Presence) error StreamSendRaw(mode uint8, subject, subcontext, label string, msg *rtapi.Envelope, presences []Presence) error SessionDisconnect(ctx context.Context, sessionID, node string) error MatchCreate(ctx context.Context, module string, params map[string]interface{}) (string, error) MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int, query string) ([]*api.Match, error) Loading server/api.go +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ type ApiServer struct { grpcGatewayServer *http.Server } func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, leaderboardRankCache LeaderboardRankCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, pipeline *Pipeline, runtime *Runtime) *ApiServer { func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, leaderboardRankCache LeaderboardRankCache, sessionRegistry SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, pipeline *Pipeline, runtime *Runtime) *ApiServer { if config.GetSocket().IdleTimeoutMs > 500 { // Ensure the GRPC Gateway timeout is just under the idle timeout (if possible) to ensure it has priority. grpcRuntime.DefaultContextTimeout = time.Duration(config.GetSocket().IdleTimeoutMs-500) * time.Millisecond Loading server/message_router.go +2 −2 Original line number Diff line number Diff line Loading @@ -38,11 +38,11 @@ type MessageRouter interface { type LocalMessageRouter struct { jsonpbMarshaler *jsonpb.Marshaler sessionRegistry *SessionRegistry sessionRegistry SessionRegistry tracker Tracker } func NewLocalMessageRouter(sessionRegistry *SessionRegistry, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler) MessageRouter { func NewLocalMessageRouter(sessionRegistry SessionRegistry, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler) MessageRouter { return &LocalMessageRouter{ jsonpbMarshaler: jsonpbMarshaler, sessionRegistry: sessionRegistry, Loading Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Added - Additional logging format option for Stackdriver Logging. - New runtime function to immediately disconnect active sockets. - New runtime function to kick arbitrary presences from streams. ### Fixed - Correctly return group user results in Lua runtime listing operation. Loading
main.go +3 −2 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ func main() { // Start up server components. matchmaker := server.NewLocalMatchmaker(startupLogger, config.GetName()) sessionRegistry := server.NewSessionRegistry() sessionRegistry := server.NewLocalSessionRegistry() tracker := server.StartLocalTracker(logger, config, sessionRegistry, jsonpbMarshaler) router := server.NewLocalMessageRouter(sessionRegistry, tracker, jsonpbMarshaler) leaderboardCache := server.NewLocalLeaderboardCache(logger, startupLogger, db) Loading @@ -107,7 +107,8 @@ func main() { matchRegistry := server.NewLocalMatchRegistry(logger, startupLogger, config, tracker, router, config.GetName()) tracker.SetMatchJoinListener(matchRegistry.Join) tracker.SetMatchLeaveListener(matchRegistry.Leave) runtime, err := server.NewRuntime(logger, startupLogger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, matchRegistry, tracker, router) streamManager := server.NewLocalStreamManager(config, sessionRegistry, tracker) runtime, err := server.NewRuntime(logger, startupLogger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, matchRegistry, tracker, streamManager, router) if err != nil { startupLogger.Fatal("Failed initializing runtime modules", zap.Error(err)) } Loading
runtime/runtime.go +5 −2 Original line number Diff line number Diff line Loading @@ -757,10 +757,13 @@ type NakamaModule interface { StreamUserJoin(mode uint8, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error) StreamUserUpdate(mode uint8, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error StreamUserLeave(mode uint8, subject, subcontext, label, userID, sessionID string) error StreamUserKick(mode uint8, subject, subcontext, label string, presence Presence) error StreamCount(mode uint8, subject, subcontext, label string) (int, error) StreamClose(mode uint8, subject, subcontext, label string) error StreamSend(mode uint8, subject, subcontext, label, data string) error StreamSendRaw(mode uint8, subject, subcontext, label string, msg *rtapi.Envelope) error StreamSend(mode uint8, subject, subcontext, label, data string, presences []Presence) error StreamSendRaw(mode uint8, subject, subcontext, label string, msg *rtapi.Envelope, presences []Presence) error SessionDisconnect(ctx context.Context, sessionID, node string) error MatchCreate(ctx context.Context, module string, params map[string]interface{}) (string, error) MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int, query string) ([]*api.Match, error) Loading
server/api.go +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ type ApiServer struct { grpcGatewayServer *http.Server } func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, leaderboardRankCache LeaderboardRankCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, pipeline *Pipeline, runtime *Runtime) *ApiServer { func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, leaderboardRankCache LeaderboardRankCache, sessionRegistry SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, pipeline *Pipeline, runtime *Runtime) *ApiServer { if config.GetSocket().IdleTimeoutMs > 500 { // Ensure the GRPC Gateway timeout is just under the idle timeout (if possible) to ensure it has priority. grpcRuntime.DefaultContextTimeout = time.Duration(config.GetSocket().IdleTimeoutMs-500) * time.Millisecond Loading
server/message_router.go +2 −2 Original line number Diff line number Diff line Loading @@ -38,11 +38,11 @@ type MessageRouter interface { type LocalMessageRouter struct { jsonpbMarshaler *jsonpb.Marshaler sessionRegistry *SessionRegistry sessionRegistry SessionRegistry tracker Tracker } func NewLocalMessageRouter(sessionRegistry *SessionRegistry, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler) MessageRouter { func NewLocalMessageRouter(sessionRegistry SessionRegistry, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler) MessageRouter { return &LocalMessageRouter{ jsonpbMarshaler: jsonpbMarshaler, sessionRegistry: sessionRegistry, Loading