Documentation ¶
Index ¶
- Constants
- Variables
- func AddFriends(logger *zap.Logger, db *sql.DB, messageRouter MessageRouter, userID uuid.UUID, ...) error
- func AddGroupUsers(logger *zap.Logger, db *sql.DB, caller uuid.UUID, groupID uuid.UUID, ...) error
- func AuthenticateCustom(logger *zap.Logger, db *sql.DB, customID, username string, create bool) (string, string, bool, error)
- func AuthenticateDevice(logger *zap.Logger, db *sql.DB, deviceID, username string, create bool) (string, string, bool, error)
- func AuthenticateEmail(logger *zap.Logger, db *sql.DB, email, password, username string, create bool) (string, string, bool, error)
- func AuthenticateFacebook(logger *zap.Logger, db *sql.DB, client *social.Client, ...) (string, string, bool, error)
- func AuthenticateGameCenter(logger *zap.Logger, db *sql.DB, client *social.Client, ...) (string, string, bool, error)
- func AuthenticateGoogle(logger *zap.Logger, db *sql.DB, client *social.Client, ...) (string, string, bool, error)
- func AuthenticateSteam(logger *zap.Logger, db *sql.DB, client *social.Client, appID int, ...) (string, string, bool, error)
- func BlockFriends(logger *zap.Logger, db *sql.DB, currentUser uuid.UUID, ids []string) error
- func ChannelMessagesList(logger *zap.Logger, db *sql.DB, caller uuid.UUID, stream PresenceStream, ...) (*api.ChannelMessageList, error)
- func ConvertLuaTable(lv *lua.LTable) map[string]interface{}
- func ConvertLuaValue(lv lua.LValue) interface{}
- func ConvertMap(l *lua.LState, data map[string]interface{}) *lua.LTable
- func ConvertValue(l *lua.LState, val interface{}) lua.LValue
- func CreateGroup(logger *zap.Logger, db *sql.DB, userID uuid.UUID, creatorID uuid.UUID, ...) (*api.Group, error)
- func DeleteFriends(logger *zap.Logger, db *sql.DB, currentUser uuid.UUID, ids []string) error
- func DeleteGroup(logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID) error
- func DeleteUser(tx *sql.Tx, userID uuid.UUID) (int64, error)
- func GetAccount(logger *zap.Logger, db *sql.DB, tracker Tracker, userID uuid.UUID) (*api.Account, error)
- func GetChannelMessages(logger *zap.Logger, db *sql.DB, userID uuid.UUID) ([]*api.ChannelMessage, error)
- func GetFriendIDs(logger *zap.Logger, db *sql.DB, userID uuid.UUID) (*api.Friends, error)
- func GetFriends(logger *zap.Logger, db *sql.DB, tracker Tracker, userID uuid.UUID) (*api.Friends, error)
- func GetUsers(logger *zap.Logger, db *sql.DB, tracker Tracker, ...) (*api.Users, error)
- func GroupDeleteAll(logger *zap.Logger, tx *sql.Tx, userID uuid.UUID) error
- func JoinAttempt(resultCh chan *MatchJoinResult, userID, sessionID uuid.UUID, ...) func(mh *MatchHandler)
- func JoinGroup(logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID) error
- func KickGroupUsers(logger *zap.Logger, db *sql.DB, caller uuid.UUID, groupID uuid.UUID, ...) error
- func LeaderboardRecordDelete(logger *zap.Logger, db *sql.DB, leaderboardCache LeaderboardCache, ...) error
- func LeaderboardRecordReadAll(logger *zap.Logger, db *sql.DB, userID uuid.UUID) ([]*api.LeaderboardRecord, error)
- func LeaderboardRecordWrite(logger *zap.Logger, db *sql.DB, leaderboardCache LeaderboardCache, ...) (*api.LeaderboardRecord, error)
- func LeaderboardRecordsDeleteAll(logger *zap.Logger, tx *sql.Tx, userID uuid.UUID) error
- func LeaderboardRecordsList(logger *zap.Logger, db *sql.DB, leaderboardCache LeaderboardCache, ...) (*api.LeaderboardRecordList, error)
- func Leave(leaves []*MatchPresence) func(mh *MatchHandler)
- func LeaveGroup(logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID) error
- func ListGroupUsers(logger *zap.Logger, db *sql.DB, tracker Tracker, groupID uuid.UUID) (*api.GroupUserList, error)
- func ListGroups(logger *zap.Logger, db *sql.DB, name string, limit int, cursorStr string) (*api.GroupList, error)
- func ListUserGroups(logger *zap.Logger, db *sql.DB, userID uuid.UUID) (*api.UserGroupList, error)
- func ListWalletLedger(logger *zap.Logger, db *sql.DB, userID uuid.UUID) ([]*walletLedger, error)
- func LoadRuntimeModules(startupLogger *zap.Logger, config Config) (map[string]lua.LGFunction, *sync.Map, error)
- func NewConfig(logger *zap.Logger) *config
- func NewJSONFileLogger(consoleLogger *zap.Logger, fpath string, level zapcore.Level) *zap.Logger
- func NewJSONLogger(output *os.File, level zapcore.Level) *zap.Logger
- func NewLuaContext(l *lua.LState, env *lua.LTable, mode ExecutionMode, uid string, ...) *lua.LTable
- func NewMultiLogger(loggers ...*zap.Logger) *zap.Logger
- func NewSocketWsAcceptor(logger *zap.Logger, config Config, sessionRegistry *SessionRegistry, ...) func(http.ResponseWriter, *http.Request)
- func NotificationDelete(logger *zap.Logger, db *sql.DB, userID uuid.UUID, notificationIDs []string) error
- func NotificationList(logger *zap.Logger, db *sql.DB, userID uuid.UUID, limit int, cursor string, ...) (*api.NotificationList, error)
- func NotificationSave(logger *zap.Logger, db *sql.DB, ...) error
- func NotificationSend(logger *zap.Logger, db *sql.DB, messageRouter MessageRouter, ...) error
- func OpenOs(L *lua.LState) int
- func OpenPackage(modules *sync.Map) func(L *lua.LState) int
- func PromoteGroupUsers(logger *zap.Logger, db *sql.DB, caller uuid.UUID, groupID uuid.UUID, ...) error
- func SetupLogging(tmpLogger *zap.Logger, config Config) (*zap.Logger, *zap.Logger)
- func StatusError(code codes.Code, msg string, cause error) error
- func StorageDeleteObjects(logger *zap.Logger, db *sql.DB, authoritativeDelete bool, ...) (codes.Code, error)
- func StorageListObjects(logger *zap.Logger, db *sql.DB, caller uuid.UUID, ownerID uuid.UUID, ...) (*api.StorageObjectList, codes.Code, error)
- func StorageListObjectsPublicRead(logger *zap.Logger, db *sql.DB, collection string, limit int, cursor string, ...) (*api.StorageObjectList, error)
- func StorageListObjectsPublicReadUser(logger *zap.Logger, db *sql.DB, userID uuid.UUID, collection string, limit int, ...) (*api.StorageObjectList, error)
- func StorageListObjectsUser(logger *zap.Logger, db *sql.DB, authoritative bool, userID uuid.UUID, ...) (*api.StorageObjectList, error)
- func StorageReadAllUserObjects(logger *zap.Logger, db *sql.DB, userID uuid.UUID) ([]*api.StorageObject, error)
- func StorageReadObjects(logger *zap.Logger, db *sql.DB, caller uuid.UUID, ...) (*api.StorageObjects, error)
- func StorageWriteObjects(logger *zap.Logger, db *sql.DB, authoritativeWrite bool, ...) (*api.StorageObjectAcks, codes.Code, error)
- func StreamToChannelId(stream PresenceStream) (string, error)
- func UpdateAccount(db *sql.DB, logger *zap.Logger, userID uuid.UUID, username string, ...) error
- func UpdateGroup(logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID, ...) error
- func UpdateWalletLedger(logger *zap.Logger, db *sql.DB, id uuid.UUID, metadata string) (*walletLedger, error)
- func UpdateWallets(logger *zap.Logger, db *sql.DB, updates []*walletUpdate) error
- func UserExistsAndDoesNotBlock(db *sql.DB, checkUserID, blocksUserID uuid.UUID) (bool, error)
- type ApiServer
- func (s *ApiServer) AddFriends(ctx context.Context, in *api.AddFriendsRequest) (*empty.Empty, error)
- func (s *ApiServer) AddGroupUsers(ctx context.Context, in *api.AddGroupUsersRequest) (*empty.Empty, error)
- func (s *ApiServer) AuthenticateCustom(ctx context.Context, in *api.AuthenticateCustomRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateDevice(ctx context.Context, in *api.AuthenticateDeviceRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateEmail(ctx context.Context, in *api.AuthenticateEmailRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateFacebook(ctx context.Context, in *api.AuthenticateFacebookRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateGameCenter(ctx context.Context, in *api.AuthenticateGameCenterRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateGoogle(ctx context.Context, in *api.AuthenticateGoogleRequest) (*api.Session, error)
- func (s *ApiServer) AuthenticateSteam(ctx context.Context, in *api.AuthenticateSteamRequest) (*api.Session, error)
- func (s *ApiServer) BlockFriends(ctx context.Context, in *api.BlockFriendsRequest) (*empty.Empty, error)
- func (s *ApiServer) CreateGroup(ctx context.Context, in *api.CreateGroupRequest) (*api.Group, error)
- func (s *ApiServer) DeleteFriends(ctx context.Context, in *api.DeleteFriendsRequest) (*empty.Empty, error)
- func (s *ApiServer) DeleteGroup(ctx context.Context, in *api.DeleteGroupRequest) (*empty.Empty, error)
- func (s *ApiServer) DeleteLeaderboardRecord(ctx context.Context, in *api.DeleteLeaderboardRecordRequest) (*empty.Empty, error)
- func (s *ApiServer) DeleteNotifications(ctx context.Context, in *api.DeleteNotificationsRequest) (*empty.Empty, error)
- func (s *ApiServer) DeleteStorageObjects(ctx context.Context, in *api.DeleteStorageObjectsRequest) (*empty.Empty, error)
- func (s *ApiServer) GetAccount(ctx context.Context, in *empty.Empty) (*api.Account, error)
- func (s *ApiServer) GetUsers(ctx context.Context, in *api.GetUsersRequest) (*api.Users, error)
- func (s *ApiServer) Healthcheck(ctx context.Context, in *empty.Empty) (*empty.Empty, error)
- func (s *ApiServer) ImportFacebookFriends(ctx context.Context, in *api.ImportFacebookFriendsRequest) (*empty.Empty, error)
- func (s *ApiServer) JoinGroup(ctx context.Context, in *api.JoinGroupRequest) (*empty.Empty, error)
- func (s *ApiServer) KickGroupUsers(ctx context.Context, in *api.KickGroupUsersRequest) (*empty.Empty, error)
- func (s *ApiServer) LeaveGroup(ctx context.Context, in *api.LeaveGroupRequest) (*empty.Empty, error)
- func (s *ApiServer) LinkCustom(ctx context.Context, in *api.AccountCustom) (*empty.Empty, error)
- func (s *ApiServer) LinkDevice(ctx context.Context, in *api.AccountDevice) (*empty.Empty, error)
- func (s *ApiServer) LinkEmail(ctx context.Context, in *api.AccountEmail) (*empty.Empty, error)
- func (s *ApiServer) LinkFacebook(ctx context.Context, in *api.LinkFacebookRequest) (*empty.Empty, error)
- func (s *ApiServer) LinkGameCenter(ctx context.Context, in *api.AccountGameCenter) (*empty.Empty, error)
- func (s *ApiServer) LinkGoogle(ctx context.Context, in *api.AccountGoogle) (*empty.Empty, error)
- func (s *ApiServer) LinkSteam(ctx context.Context, in *api.AccountSteam) (*empty.Empty, error)
- func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannelMessagesRequest) (*api.ChannelMessageList, error)
- func (s *ApiServer) ListFriends(ctx context.Context, in *empty.Empty) (*api.Friends, error)
- func (s *ApiServer) ListGroupUsers(ctx context.Context, in *api.ListGroupUsersRequest) (*api.GroupUserList, error)
- func (s *ApiServer) ListGroups(ctx context.Context, in *api.ListGroupsRequest) (*api.GroupList, error)
- func (s *ApiServer) ListLeaderboardRecords(ctx context.Context, in *api.ListLeaderboardRecordsRequest) (*api.LeaderboardRecordList, error)
- func (s *ApiServer) ListMatches(ctx context.Context, in *api.ListMatchesRequest) (*api.MatchList, error)
- func (s *ApiServer) ListNotifications(ctx context.Context, in *api.ListNotificationsRequest) (*api.NotificationList, error)
- func (s *ApiServer) ListStorageObjects(ctx context.Context, in *api.ListStorageObjectsRequest) (*api.StorageObjectList, error)
- func (s *ApiServer) ListUserGroups(ctx context.Context, in *api.ListUserGroupsRequest) (*api.UserGroupList, error)
- func (s *ApiServer) PromoteGroupUsers(ctx context.Context, in *api.PromoteGroupUsersRequest) (*empty.Empty, error)
- func (s *ApiServer) ReadStorageObjects(ctx context.Context, in *api.ReadStorageObjectsRequest) (*api.StorageObjects, error)
- func (s *ApiServer) RpcFunc(ctx context.Context, in *api.Rpc) (*api.Rpc, error)
- func (s *ApiServer) Stop()
- func (s *ApiServer) UnlinkCustom(ctx context.Context, in *api.AccountCustom) (*empty.Empty, error)
- func (s *ApiServer) UnlinkDevice(ctx context.Context, in *api.AccountDevice) (*empty.Empty, error)
- func (s *ApiServer) UnlinkEmail(ctx context.Context, in *api.AccountEmail) (*empty.Empty, error)
- func (s *ApiServer) UnlinkFacebook(ctx context.Context, in *api.AccountFacebook) (*empty.Empty, error)
- func (s *ApiServer) UnlinkGameCenter(ctx context.Context, in *api.AccountGameCenter) (*empty.Empty, error)
- func (s *ApiServer) UnlinkGoogle(ctx context.Context, in *api.AccountGoogle) (*empty.Empty, error)
- func (s *ApiServer) UnlinkSteam(ctx context.Context, in *api.AccountSteam) (*empty.Empty, error)
- func (s *ApiServer) UpdateAccount(ctx context.Context, in *api.UpdateAccountRequest) (*empty.Empty, error)
- func (s *ApiServer) UpdateGroup(ctx context.Context, in *api.UpdateGroupRequest) (*empty.Empty, error)
- func (s *ApiServer) WriteLeaderboardRecord(ctx context.Context, in *api.WriteLeaderboardRecordRequest) (*api.LeaderboardRecord, error)
- func (s *ApiServer) WriteStorageObjects(ctx context.Context, in *api.WriteStorageObjectsRequest) (*api.StorageObjectAcks, error)
- type Callbacks
- type ChannelIdToStreamResult
- type Config
- type ConsoleConfig
- type ConsoleServer
- func (s *ConsoleServer) DeleteAccount(ctx context.Context, in *console.AccountIdRequest) (*empty.Empty, error)
- func (s *ConsoleServer) ExportAccount(ctx context.Context, in *console.AccountIdRequest) (*console.AccountExport, error)
- func (s *ConsoleServer) Login(context.Context, *console.AuthenticateRequest) (*console.Session, error)
- func (s *ConsoleServer) Stop()
- type DatabaseConfig
- type ExecutionMode
- type LSentinelType
- type Leaderboard
- type LeaderboardCache
- type LocalLeaderboardCache
- type LocalMatchRegistry
- func (r *LocalMatchRegistry) GetMatch(id uuid.UUID) *MatchHandler
- func (r *LocalMatchRegistry) Join(id uuid.UUID, node string, userID, sessionID uuid.UUID, ...) (bool, bool, string, string)
- func (r *LocalMatchRegistry) Kick(stream PresenceStream, presences []*MatchPresence)
- func (r *LocalMatchRegistry) Leave(id uuid.UUID, presences []*MatchPresence)
- func (r *LocalMatchRegistry) ListMatches(limit int, authoritative *wrappers.BoolValue, label *wrappers.StringValue, ...) []*api.Match
- func (r *LocalMatchRegistry) NewMatch(name string, params interface{}) (*MatchHandler, error)
- func (r *LocalMatchRegistry) RemoveMatch(id uuid.UUID, stream PresenceStream)
- func (r *LocalMatchRegistry) SendData(id uuid.UUID, node string, userID, sessionID uuid.UUID, ...)
- func (r *LocalMatchRegistry) Stop()
- type LocalMatchmaker
- type LocalMessageRouter
- type LocalTracker
- func (t *LocalTracker) Count() int
- func (t *LocalTracker) CountByStream(stream PresenceStream) int
- func (t *LocalTracker) CountByStreamModeFilter(modes map[uint8]*uint8) map[*PresenceStream]int32
- func (t *LocalTracker) GetLocalBySessionIDStreamUserID(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID) *PresenceMeta
- func (t *LocalTracker) ListByStream(stream PresenceStream, includeHidden bool) []*Presence
- func (t *LocalTracker) ListLocalSessionIDByStream(stream PresenceStream) []uuid.UUID
- func (t *LocalTracker) ListNodesForStream(stream PresenceStream) map[string]struct{}
- func (t *LocalTracker) ListPresenceIDByStream(stream PresenceStream) []*PresenceID
- func (t *LocalTracker) SetMatchLeaveListener(f func(id uuid.UUID, leaves []*MatchPresence))
- func (t *LocalTracker) Stop()
- func (t *LocalTracker) StreamExists(stream PresenceStream) bool
- func (t *LocalTracker) Track(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, ...) (bool, bool)
- func (t *LocalTracker) Untrack(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID)
- func (t *LocalTracker) UntrackAll(sessionID uuid.UUID)
- func (t *LocalTracker) UntrackByStream(stream PresenceStream)
- func (t *LocalTracker) UntrackLocalByStream(stream PresenceStream)
- func (t *LocalTracker) Update(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, ...) bool
- type LoggerConfig
- type MatchDataMessage
- type MatchHandler
- type MatchJoinResult
- type MatchPresence
- type MatchRegistry
- type Matchmaker
- type MatchmakerEntry
- type MatchmakerPresence
- type MessageRouter
- type Metrics
- type MetricsConfig
- type NakamaModule
- type Pipeline
- type Presence
- type PresenceEvent
- type PresenceID
- type PresenceMeta
- type PresenceStream
- type RegCallbacks
- type Runtime
- func (r *Runtime) GetCallback(e ExecutionMode, key string) *lua.LFunction
- func (r *Runtime) InvokeFunction(execMode ExecutionMode, fn *lua.LFunction, uid string, username string, ...) (interface{}, error, codes.Code)
- func (r *Runtime) NewStateThread() (*lua.LState, context.CancelFunc)
- func (r *Runtime) Stop()
- type RuntimeConfig
- type RuntimeModule
- type RuntimePool
- type Session
- type SessionConfig
- type SessionFormat
- type SessionRegistry
- type SocialConfig
- type SocialConfigSteam
- type SocketConfig
- type Tracker
Constants ¶
const ( NOTIFICATION_DM_REQUEST int32 = -1 NOTIFICATION_FRIEND_REQUEST int32 = -2 NOTIFICATION_FRIEND_ACCEPT int32 = -3 NOTIFICATION_GROUP_ADD int32 = -4 NOTIFICATION_GROUP_JOIN_REQUEST int32 = -5 NOTIFICATION_FRIEND_JOIN_GAME int32 = -6 )
const ( LeaderboardSortOrderAscending = iota LeaderboardSortOrderDescending )
const ( LeaderboardOperatorBest = iota LeaderboardOperatorSet LeaderboardOperatorIncrement )
const ( InputQueueSize = 128 CallQueueSize = 128 )
const ( ChannelMessageTypeChat int32 = iota ChannelMessageTypeChatUpdate ChannelMessageTypeChatRemove ChannelMessageTypeGroupJoin ChannelMessageTypeGroupAdd ChannelMessageTypeGroupKick ChannelMessageTypeGroupPromoted )
const ( StreamModeNotifications uint8 = iota StreamModeStatus StreamModeChannel StreamModeGroup StreamModeDM StreamModeMatchRelayed StreamModeMatchAuthoritative )
const API_PREFIX = "/nakama.api.Nakama/"
const CALLBACKS = "runtime_callbacks"
const EventsQueueSize = 512
const LTSentinel = lua.LValueType(-1)
const RTAPI_PREFIX = "*rtapi.Envelope_"
Variables ¶
var ( ErrChannelIdInvalid = errors.New("invalid channel id") ErrChannelCursorInvalid = errors.New("invalid channel cursor") ErrChannelGroupNotFound = errors.New("group not found") )
var ( ErrGroupNameInUse = errors.New("group name in use") ErrGroupPermissionDenied = errors.New("group permission denied") ErrGroupNoUpdateOps = errors.New("no group updates") ErrGroupNotUpdated = errors.New("group not updated") ErrGroupNotFound = errors.New("group not found") ErrGroupFull = errors.New("group is full") ErrGroupLastSuperadmin = errors.New("user is last group superadmin") )
var ( ErrLeaderboardNotFound = errors.New("leaderboard not found") ErrLeaderboardAuthoritative = errors.New("leaderboard only allows authoritative submissions") ErrLeaderboardInvalidCursor = errors.New("leaderboard cursor invalid") )
var ( MatchFilterValue = uint8(0) MatchFilterPtr = &MatchFilterValue MatchFilterAny = map[uint8]*uint8{StreamModeMatchRelayed: MatchFilterPtr, StreamModeMatchAuthoritative: MatchFilterPtr} MatchFilterRelayed = map[uint8]*uint8{StreamModeMatchRelayed: MatchFilterPtr} MatchFilterAuthoritative = map[uint8]*uint8{StreamModeMatchAuthoritative: MatchFilterPtr} )
var ErrAccountNotFound = errors.New("account not found")
var ErrChannelMessageUpdateNotFound = errors.New("channel message not found")
var ErrMatchmakerTicketNotFound = errors.New("ticket not found")
var ErrRowsAffectedCount = errors.New("rows_affected_count")
var ErrSessionQueueFull = errors.New("session outgoing queue full")
var LSentinel = lua.LValue(&LSentinelType{})
Functions ¶
func AddFriends ¶
func AddGroupUsers ¶
func AuthenticateCustom ¶
func AuthenticateDevice ¶
func AuthenticateEmail ¶
func AuthenticateFacebook ¶
func AuthenticateGameCenter ¶
func AuthenticateGoogle ¶
func AuthenticateSteam ¶
func BlockFriends ¶
func ChannelMessagesList ¶
func ConvertLuaTable ¶ added in v0.13.0
func ConvertLuaTable(lv *lua.LTable) map[string]interface{}
func ConvertLuaValue ¶
func ConvertLuaValue(lv lua.LValue) interface{}
func ConvertMap ¶ added in v0.13.0
func ConvertMap(l *lua.LState, data map[string]interface{}) *lua.LTable
func ConvertValue ¶
func ConvertValue(l *lua.LState, val interface{}) lua.LValue
func CreateGroup ¶
func DeleteFriends ¶
func DeleteGroup ¶
func GetAccount ¶
func GetChannelMessages ¶
func GetFriendIDs ¶
func GetFriends ¶
func JoinAttempt ¶
func JoinAttempt(resultCh chan *MatchJoinResult, userID, sessionID uuid.UUID, username, node string) func(mh *MatchHandler)
func KickGroupUsers ¶
func LeaderboardRecordDelete ¶
func LeaderboardRecordWrite ¶
func LeaderboardRecordsList ¶
func LeaderboardRecordsList(logger *zap.Logger, db *sql.DB, leaderboardCache LeaderboardCache, leaderboardId string, limit *wrappers.Int32Value, cursor string, ownerIds []string) (*api.LeaderboardRecordList, error)
func Leave ¶
func Leave(leaves []*MatchPresence) func(mh *MatchHandler)
func LeaveGroup ¶
func ListGroupUsers ¶
func ListGroups ¶
func ListUserGroups ¶
func ListWalletLedger ¶
func LoadRuntimeModules ¶
func NewConfig ¶
NewConfig constructs a Config struct which represents server settings, and populates it with default values.
func NewJSONFileLogger ¶
func NewJSONLogger ¶ added in v0.12.2
func NewLuaContext ¶ added in v0.13.0
func NewLuaContext(l *lua.LState, env *lua.LTable, mode ExecutionMode, uid string, username string, sessionExpiry int64, sid string) *lua.LTable
func NewSocketWsAcceptor ¶
func NewSocketWsAcceptor(logger *zap.Logger, config Config, sessionRegistry *SessionRegistry, matchmaker Matchmaker, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, pipeline *Pipeline) func(http.ResponseWriter, *http.Request)
func NotificationDelete ¶
func NotificationList ¶
func NotificationSave ¶
func NotificationSend ¶
func NotificationSend(logger *zap.Logger, db *sql.DB, messageRouter MessageRouter, notifications map[uuid.UUID][]*api.Notification) error
func OpenPackage ¶
func PromoteGroupUsers ¶
func SetupLogging ¶ added in v1.0.0
func StatusError ¶ added in v1.4.2
Helper function for creating status errors that wrap underlying causes, usually DB errors.
func StorageDeleteObjects ¶
func StorageListObjects ¶
func StorageListObjectsUser ¶
func StorageReadObjects ¶
func StorageReadObjects(logger *zap.Logger, db *sql.DB, caller uuid.UUID, objectIDs []*api.ReadStorageObjectId) (*api.StorageObjects, error)
func StorageWriteObjects ¶
func StreamToChannelId ¶
func StreamToChannelId(stream PresenceStream) (string, error)
func UpdateAccount ¶
func UpdateGroup ¶
func UpdateWalletLedger ¶
func UpdateWallets ¶
Types ¶
type ApiServer ¶
type ApiServer struct {
// contains filtered or unexported fields
}
func StartApiServer ¶
func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, pipeline *Pipeline, runtimePool *RuntimePool) *ApiServer
func (*ApiServer) AddFriends ¶
func (*ApiServer) AddGroupUsers ¶
func (*ApiServer) AuthenticateCustom ¶
func (*ApiServer) AuthenticateDevice ¶
func (*ApiServer) AuthenticateEmail ¶
func (*ApiServer) AuthenticateFacebook ¶
func (*ApiServer) AuthenticateGameCenter ¶
func (*ApiServer) AuthenticateGoogle ¶
func (*ApiServer) AuthenticateSteam ¶
func (*ApiServer) BlockFriends ¶
func (*ApiServer) CreateGroup ¶
func (*ApiServer) DeleteFriends ¶
func (*ApiServer) DeleteGroup ¶
func (*ApiServer) DeleteLeaderboardRecord ¶
func (*ApiServer) DeleteNotifications ¶
func (*ApiServer) DeleteStorageObjects ¶
func (*ApiServer) GetAccount ¶
func (*ApiServer) Healthcheck ¶
func (*ApiServer) ImportFacebookFriends ¶
func (*ApiServer) KickGroupUsers ¶
func (*ApiServer) LeaveGroup ¶
func (*ApiServer) LinkCustom ¶
func (*ApiServer) LinkDevice ¶
func (*ApiServer) LinkFacebook ¶
func (*ApiServer) LinkGameCenter ¶
func (*ApiServer) LinkGoogle ¶
func (*ApiServer) ListChannelMessages ¶
func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannelMessagesRequest) (*api.ChannelMessageList, error)
func (*ApiServer) ListFriends ¶
func (*ApiServer) ListGroupUsers ¶
func (s *ApiServer) ListGroupUsers(ctx context.Context, in *api.ListGroupUsersRequest) (*api.GroupUserList, error)
func (*ApiServer) ListGroups ¶
func (*ApiServer) ListLeaderboardRecords ¶
func (s *ApiServer) ListLeaderboardRecords(ctx context.Context, in *api.ListLeaderboardRecordsRequest) (*api.LeaderboardRecordList, error)
func (*ApiServer) ListMatches ¶
func (*ApiServer) ListNotifications ¶
func (s *ApiServer) ListNotifications(ctx context.Context, in *api.ListNotificationsRequest) (*api.NotificationList, error)
func (*ApiServer) ListStorageObjects ¶
func (s *ApiServer) ListStorageObjects(ctx context.Context, in *api.ListStorageObjectsRequest) (*api.StorageObjectList, error)
func (*ApiServer) ListUserGroups ¶
func (s *ApiServer) ListUserGroups(ctx context.Context, in *api.ListUserGroupsRequest) (*api.UserGroupList, error)
func (*ApiServer) PromoteGroupUsers ¶
func (*ApiServer) ReadStorageObjects ¶
func (s *ApiServer) ReadStorageObjects(ctx context.Context, in *api.ReadStorageObjectsRequest) (*api.StorageObjects, error)
func (*ApiServer) UnlinkCustom ¶
func (*ApiServer) UnlinkDevice ¶
func (*ApiServer) UnlinkEmail ¶
func (*ApiServer) UnlinkFacebook ¶
func (*ApiServer) UnlinkGameCenter ¶
func (*ApiServer) UnlinkGoogle ¶
func (*ApiServer) UnlinkSteam ¶
func (*ApiServer) UpdateAccount ¶
func (*ApiServer) UpdateGroup ¶
func (*ApiServer) WriteLeaderboardRecord ¶
func (s *ApiServer) WriteLeaderboardRecord(ctx context.Context, in *api.WriteLeaderboardRecordRequest) (*api.LeaderboardRecord, error)
func (*ApiServer) WriteStorageObjects ¶
func (s *ApiServer) WriteStorageObjects(ctx context.Context, in *api.WriteStorageObjectsRequest) (*api.StorageObjectAcks, error)
type ChannelIdToStreamResult ¶
type ChannelIdToStreamResult struct {
Stream PresenceStream
}
Wrapper type to avoid allocating a stream struct when the input is invalid.
func ChannelIdToStream ¶
func ChannelIdToStream(channelId string) (*ChannelIdToStreamResult, error)
type Config ¶
type Config interface { GetName() string GetDataDir() string GetLogger() *LoggerConfig GetMetrics() *MetricsConfig GetSession() *SessionConfig GetSocket() *SocketConfig GetDatabase() *DatabaseConfig GetSocial() *SocialConfig GetRuntime() *RuntimeConfig GetConsole() *ConsoleConfig }
Config interface is the Nakama core configuration.
type ConsoleConfig ¶
type ConsoleConfig struct { Port int `yaml:"port" json:"port" usage:"The port for accepting connections for the embedded console, listening on all interfaces."` Username string `yaml:"username" json:"username" usage:"Username for the embedded console."` Password string `yaml:"password" json:"password" usage:"Password for the embedded console."` }
ConsoleConfig is configuration relevant to the embedded console.
func NewConsoleConfig ¶
func NewConsoleConfig() *ConsoleConfig
NewConsoleConfig creates a new ConsoleConfig struct.
type ConsoleServer ¶
type ConsoleServer struct {
// contains filtered or unexported fields
}
func StartConsoleServer ¶
func (*ConsoleServer) DeleteAccount ¶
func (s *ConsoleServer) DeleteAccount(ctx context.Context, in *console.AccountIdRequest) (*empty.Empty, error)
func (*ConsoleServer) ExportAccount ¶
func (s *ConsoleServer) ExportAccount(ctx context.Context, in *console.AccountIdRequest) (*console.AccountExport, error)
func (*ConsoleServer) Login ¶
func (s *ConsoleServer) Login(context.Context, *console.AuthenticateRequest) (*console.Session, error)
func (*ConsoleServer) Stop ¶
func (s *ConsoleServer) Stop()
type DatabaseConfig ¶
type DatabaseConfig struct { Addresses []string `yaml:"address" json:"address" usage:"List of CockroachDB servers (username:password@address:port/dbname)."` ConnMaxLifetimeMs int `` /* 173-byte string literal not displayed */ MaxOpenConns int `yaml:"max_open_conns" json:"max_open_conns" usage:"Maximum number of allowed open connections to the database."` MaxIdleConns int `yaml:"max_idle_conns" json:"max_idle_conns" usage:"Maximum number of allowed open but unused connections to the database."` }
DatabaseConfig is configuration relevant to the Database storage.
func NewDatabaseConfig ¶
func NewDatabaseConfig() *DatabaseConfig
NewDatabaseConfig creates a new DatabaseConfig struct.
type ExecutionMode ¶ added in v0.13.0
type ExecutionMode int
const ( ExecutionModeRunOnce ExecutionMode = iota ExecutionModeRPC ExecutionModeBefore ExecutionModeAfter ExecutionModeMatch ExecutionModeMatchmaker )
func (ExecutionMode) String ¶ added in v0.13.0
func (e ExecutionMode) String() string
type LSentinelType ¶
type LSentinelType struct {
lua.LNilType
}
func (*LSentinelType) String ¶
func (s *LSentinelType) String() string
func (*LSentinelType) Type ¶
func (s *LSentinelType) Type() lua.LValueType
type Leaderboard ¶
type LeaderboardCache ¶
type LeaderboardCache interface { Get(id string) *Leaderboard Create(id string, authoritative bool, sortOrder, operator int, resetSchedule, metadata string) error Delete(id string) error }
func NewLocalLeaderboardCache ¶
func NewLocalLeaderboardCache(logger, startupLogger *zap.Logger, db *sql.DB) LeaderboardCache
type LocalLeaderboardCache ¶
func (*LocalLeaderboardCache) Delete ¶
func (l *LocalLeaderboardCache) Delete(id string) error
func (*LocalLeaderboardCache) Get ¶
func (l *LocalLeaderboardCache) Get(id string) *Leaderboard
type LocalMatchRegistry ¶
func (*LocalMatchRegistry) GetMatch ¶
func (r *LocalMatchRegistry) GetMatch(id uuid.UUID) *MatchHandler
func (*LocalMatchRegistry) Kick ¶
func (r *LocalMatchRegistry) Kick(stream PresenceStream, presences []*MatchPresence)
func (*LocalMatchRegistry) Leave ¶
func (r *LocalMatchRegistry) Leave(id uuid.UUID, presences []*MatchPresence)
func (*LocalMatchRegistry) ListMatches ¶
func (r *LocalMatchRegistry) ListMatches(limit int, authoritative *wrappers.BoolValue, label *wrappers.StringValue, minSize *wrappers.Int32Value, maxSize *wrappers.Int32Value) []*api.Match
func (*LocalMatchRegistry) NewMatch ¶
func (r *LocalMatchRegistry) NewMatch(name string, params interface{}) (*MatchHandler, error)
func (*LocalMatchRegistry) RemoveMatch ¶
func (r *LocalMatchRegistry) RemoveMatch(id uuid.UUID, stream PresenceStream)
func (*LocalMatchRegistry) SendData ¶
func (r *LocalMatchRegistry) SendData(id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, opCode int64, data []byte)
func (*LocalMatchRegistry) Stop ¶
func (r *LocalMatchRegistry) Stop()
type LocalMatchmaker ¶
func (*LocalMatchmaker) Remove ¶
func (m *LocalMatchmaker) Remove(sessionID uuid.UUID, ticket string) error
func (*LocalMatchmaker) RemoveAll ¶
func (m *LocalMatchmaker) RemoveAll(sessionID uuid.UUID) error
type LocalMessageRouter ¶
type LocalMessageRouter struct {
// contains filtered or unexported fields
}
func (*LocalMessageRouter) SendToPresenceIDs ¶
func (r *LocalMessageRouter) SendToPresenceIDs(logger *zap.Logger, presenceIDs []*PresenceID, envelope *rtapi.Envelope)
func (*LocalMessageRouter) SendToStream ¶
func (r *LocalMessageRouter) SendToStream(logger *zap.Logger, stream PresenceStream, envelope *rtapi.Envelope)
type LocalTracker ¶
func (*LocalTracker) Count ¶
func (t *LocalTracker) Count() int
func (*LocalTracker) CountByStream ¶
func (t *LocalTracker) CountByStream(stream PresenceStream) int
func (*LocalTracker) CountByStreamModeFilter ¶
func (t *LocalTracker) CountByStreamModeFilter(modes map[uint8]*uint8) map[*PresenceStream]int32
func (*LocalTracker) GetLocalBySessionIDStreamUserID ¶
func (t *LocalTracker) GetLocalBySessionIDStreamUserID(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID) *PresenceMeta
func (*LocalTracker) ListByStream ¶
func (t *LocalTracker) ListByStream(stream PresenceStream, includeHidden bool) []*Presence
func (*LocalTracker) ListLocalSessionIDByStream ¶
func (t *LocalTracker) ListLocalSessionIDByStream(stream PresenceStream) []uuid.UUID
func (*LocalTracker) ListNodesForStream ¶
func (t *LocalTracker) ListNodesForStream(stream PresenceStream) map[string]struct{}
func (*LocalTracker) ListPresenceIDByStream ¶
func (t *LocalTracker) ListPresenceIDByStream(stream PresenceStream) []*PresenceID
func (*LocalTracker) SetMatchLeaveListener ¶
func (t *LocalTracker) SetMatchLeaveListener(f func(id uuid.UUID, leaves []*MatchPresence))
func (*LocalTracker) Stop ¶
func (t *LocalTracker) Stop()
func (*LocalTracker) StreamExists ¶
func (t *LocalTracker) StreamExists(stream PresenceStream) bool
func (*LocalTracker) Track ¶
func (t *LocalTracker) Track(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, meta PresenceMeta, allowIfFirstForSession bool) (bool, bool)
func (*LocalTracker) Untrack ¶
func (t *LocalTracker) Untrack(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID)
func (*LocalTracker) UntrackAll ¶
func (t *LocalTracker) UntrackAll(sessionID uuid.UUID)
func (*LocalTracker) UntrackByStream ¶
func (t *LocalTracker) UntrackByStream(stream PresenceStream)
func (*LocalTracker) UntrackLocalByStream ¶
func (t *LocalTracker) UntrackLocalByStream(stream PresenceStream)
func (*LocalTracker) Update ¶
func (t *LocalTracker) Update(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, meta PresenceMeta, allowIfFirstForSession bool) bool
type LoggerConfig ¶
type LoggerConfig struct { Level string `yaml:"level" json:"level" usage:"Log level to set. Valid values are 'debug', 'info', 'warn', 'error'. "` Stdout bool `yaml:"stdout" json:"stdout" usage:"Log to standard console output (as well as to a file if set)."` File string `` /* 135-byte string literal not displayed */ }
LoggerConfig is configuration relevant to logging levels and output.
func NewLoggerConfig ¶
func NewLoggerConfig() *LoggerConfig
NewLogConfig creates a new LoggerConfig struct.
type MatchDataMessage ¶
type MatchHandler ¶
type MatchHandler struct { sync.Mutex // Identification not (directly) controlled by match init. ID uuid.UUID Node string IDStr string Stream PresenceStream // Immutable configuration set by match init. Label string Rate int // contains filtered or unexported fields }
func NewMatchHandler ¶
func NewMatchHandler(logger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, tracker Tracker, router MessageRouter, stdLibs map[string]lua.LGFunction, once *sync.Once, id uuid.UUID, node string, name string, params interface{}) (*MatchHandler, error)
func (*MatchHandler) Close ¶
func (mh *MatchHandler) Close()
Used when the match is closed externally.
func (*MatchHandler) QueueCall ¶
func (mh *MatchHandler) QueueCall(f func(*MatchHandler)) bool
func (*MatchHandler) QueueData ¶
func (mh *MatchHandler) QueueData(m *MatchDataMessage)
func (*MatchHandler) Stop ¶
func (mh *MatchHandler) Stop()
Used when an internal match process (or error) requires it to stop.
type MatchJoinResult ¶
type MatchPresence ¶
type MatchRegistry ¶
type MatchRegistry interface { // Create and start a new match, given a Lua module name. NewMatch(name string, params interface{}) (*MatchHandler, error) // Return a match handler by ID, only from the local node. GetMatch(id uuid.UUID) *MatchHandler // Remove a tracked match and ensure all its presences are cleaned up. // Does not ensure the match process itself is no longer running, that must be handled separately. RemoveMatch(id uuid.UUID, stream PresenceStream) // List (and optionally filter) currently running matches. // This can list across both authoritative and relayed matches. ListMatches(limit int, authoritative *wrappers.BoolValue, label *wrappers.StringValue, minSize *wrappers.Int32Value, maxSize *wrappers.Int32Value) []*api.Match // Stop the match registry and close all matches it's tracking. Stop() // Pass a user join attempt to a match handler. Returns if the match was found, if the join was accepted, a reason for any rejection, and the match label. Join(id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string) (bool, bool, string, string) // Notify a match handler that a user has left or disconnected. // Expects that the caller has already determined the match is hosted on the current node. Leave(id uuid.UUID, presences []*MatchPresence) // Called by match handlers to request the removal fo a match participant. Kick(stream PresenceStream, presences []*MatchPresence) // Pass a data payload (usually from a user) to the appropriate match handler. // Assumes that the data sender has already been validated as a match participant before this call. SendData(id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, opCode int64, data []byte) }
func NewLocalMatchRegistry ¶
func NewLocalMatchRegistry(logger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, sessionRegistry *SessionRegistry, tracker Tracker, router MessageRouter, stdLibs map[string]lua.LGFunction, once *sync.Once, node string) MatchRegistry
type Matchmaker ¶ added in v0.13.0
type Matchmaker interface { Add(session Session, query string, minCount int, maxCount int, stringProperties map[string]string, numericProperties map[string]float64) (string, []*MatchmakerEntry, error) Remove(sessionID uuid.UUID, ticket string) error RemoveAll(sessionID uuid.UUID) error }
func NewLocalMatchmaker ¶
func NewLocalMatchmaker(startupLogger *zap.Logger, node string) Matchmaker
type MatchmakerEntry ¶
type MatchmakerEntry struct { Ticket string `json:"ticket"` Presence *MatchmakerPresence `json:"presence"` Properties map[string]interface{} `json:"properties"` // Cached for when we need them returned to clients, but not indexed. StringProperties map[string]string `json:"-"` NumericProperties map[string]float64 `json:"-"` SessionID uuid.UUID `json:"-"` }
type MatchmakerPresence ¶
type MessageRouter ¶
type MessageRouter interface { SendToPresenceIDs(*zap.Logger, []*PresenceID, *rtapi.Envelope) SendToStream(*zap.Logger, PresenceStream, *rtapi.Envelope) }
MessageRouter is responsible for sending a message to a list of presences or to an entire stream.
func NewLocalMessageRouter ¶
func NewLocalMessageRouter(sessionRegistry *SessionRegistry, tracker Tracker, jsonpbMarshaler *jsonpb.Marshaler) MessageRouter
type MetricsConfig ¶
type MetricsConfig struct { ReportingFreqSec int `yaml:"reporting_freq_sec" json:"reporting_freq_sec" usage:"Frequency of metrics exports. Default is 10 seconds."` StackdriverProjectID string `` /* 218-byte string literal not displayed */ Namespace string `` /* 135-byte string literal not displayed */ PrometheusPort int `yaml:"prometheus_port" json:"prometheus_port" usage:"Port to expose Prometheus. If '0' Prometheus exports are disabled."` }
MetricsConfig is configuration relevant to metrics capturing and output.
func NewMetricsConfig ¶
func NewMetricsConfig() *MetricsConfig
NewMetricsConfig creates a new MatricsConfig struct.
type NakamaModule ¶ added in v0.13.0
type NakamaModule struct {
// contains filtered or unexported fields
}
func NewNakamaModule ¶ added in v0.13.0
func NewNakamaModule(logger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, l *lua.LState, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, tracker Tracker, router MessageRouter, once *sync.Once, announceCallback func(ExecutionMode, string)) *NakamaModule
func (*NakamaModule) Loader ¶ added in v0.13.0
func (n *NakamaModule) Loader(l *lua.LState) int
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
func NewPipeline ¶
func NewPipeline(config Config, db *sql.DB, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, matchmaker Matchmaker, tracker Tracker, router MessageRouter, runtimePool *RuntimePool) *Pipeline
type Presence ¶
type Presence struct { ID PresenceID Stream PresenceStream UserID uuid.UUID Meta PresenceMeta }
type PresenceEvent ¶
type PresenceID ¶
type PresenceID struct { Node string SessionID uuid.UUID }
type PresenceMeta ¶
type PresenceMeta struct { Format SessionFormat Hidden bool Persistence bool Username string Status string }
type PresenceStream ¶
type RegCallbacks ¶
type RegCallbacks struct { RPC map[string]interface{} Before map[string]interface{} After map[string]interface{} Matchmaker interface{} }
func ValidateRuntimeModules ¶
func ValidateRuntimeModules(logger, startupLogger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, tracker Tracker, router MessageRouter, stdLibs map[string]lua.LGFunction, modules *sync.Map, once *sync.Once) (*RegCallbacks, error)
type Runtime ¶ added in v0.13.0
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) GetCallback ¶
func (r *Runtime) GetCallback(e ExecutionMode, key string) *lua.LFunction
func (*Runtime) InvokeFunction ¶
func (*Runtime) NewStateThread ¶ added in v0.13.0
func (r *Runtime) NewStateThread() (*lua.LState, context.CancelFunc)
type RuntimeConfig ¶ added in v0.13.0
type RuntimeConfig struct { Environment map[string]interface{} Env []string `yaml:"env" json:"env"` Path string `yaml:"path" json:"path" usage:"Path for the server to scan for *.lua files."` HTTPKey string `yaml:"http_key" json:"http_key" usage:"Runtime HTTP Invocation key."` }
RuntimeConfig is configuration relevant to the Runtime Lua VM.
func NewRuntimeConfig ¶ added in v0.13.0
func NewRuntimeConfig() *RuntimeConfig
NewRuntimeConfig creates a new RuntimeConfig struct.
type RuntimeModule ¶ added in v1.1.0
type RuntimePool ¶ added in v1.1.0
type RuntimePool struct {
// contains filtered or unexported fields
}
func NewRuntimePool ¶ added in v1.1.0
func NewRuntimePool(logger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, sessionRegistry *SessionRegistry, matchRegistry MatchRegistry, tracker Tracker, router MessageRouter, stdLibs map[string]lua.LGFunction, modules *sync.Map, regCallbacks *RegCallbacks, once *sync.Once) *RuntimePool
func (*RuntimePool) Get ¶ added in v1.1.0
func (rp *RuntimePool) Get() *Runtime
func (*RuntimePool) HasCallback ¶
func (rp *RuntimePool) HasCallback(mode ExecutionMode, id string) bool
func (*RuntimePool) Put ¶ added in v1.1.0
func (rp *RuntimePool) Put(r *Runtime)
type Session ¶
type Session interface { Logger() *zap.Logger ID() uuid.UUID UserID() uuid.UUID Username() string SetUsername(string) Expiry() int64 Consume(func(logger *zap.Logger, session Session, envelope *rtapi.Envelope) bool) Format() SessionFormat Send(envelope *rtapi.Envelope) error SendBytes(payload []byte) error Close() }
func NewSessionWS ¶
func NewSessionWS(logger *zap.Logger, config Config, userID uuid.UUID, username string, expiry int64, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler, conn *websocket.Conn, sessionRegistry *SessionRegistry, matchmaker Matchmaker, tracker Tracker) Session
type SessionConfig ¶
type SessionConfig struct { EncryptionKey string `yaml:"encryption_key" json:"encryption_key" usage:"The encryption key used to produce the client token."` TokenExpirySec int64 `yaml:"token_expiry_sec" json:"token_expiry_sec" usage:"Token expiry in seconds."` }
SessionConfig is configuration relevant to the session.
func NewSessionConfig ¶
func NewSessionConfig() *SessionConfig
NewSessionConfig creates a new SessionConfig struct.
type SessionFormat ¶ added in v1.2.0
type SessionFormat uint8
const ( SessionFormatJson SessionFormat = iota SessionFormatProtobuf )
type SessionRegistry ¶
SessionRegistry maintains a thread-safe list of sessions to their IDs.
func NewSessionRegistry ¶
func NewSessionRegistry() *SessionRegistry
func (*SessionRegistry) Get ¶
func (r *SessionRegistry) Get(sessionID uuid.UUID) Session
func (*SessionRegistry) Stop ¶
func (r *SessionRegistry) Stop()
type SocialConfig ¶
type SocialConfig struct {
Steam *SocialConfigSteam `yaml:"steam" json:"steam" usage:"Steam configuration."`
}
SocialConfig is configuration relevant to the social authentication providers.
func NewSocialConfig ¶
func NewSocialConfig() *SocialConfig
NewSocialConfig creates a new SocialConfig struct.
type SocialConfigSteam ¶
type SocialConfigSteam struct { PublisherKey string `yaml:"publisher_key" json:"publisher_key" usage:"Steam Publisher Key value."` AppID int `yaml:"app_id" json:"app_id" usage:"Steam App ID."` }
SocialConfigSteam is configuration relevant to Steam
type SocketConfig ¶ added in v1.0.0
type SocketConfig struct { ServerKey string `yaml:"server_key" json:"server_key" usage:"Server key to use to establish a connection to the server."` Port int `yaml:"port" json:"port" usage:"The port for accepting connections from the client, listening on all interfaces."` MaxMessageSizeBytes int64 `` /* 201-byte string literal not displayed */ ReadTimeoutMs int `` /* 145-byte string literal not displayed */ WriteTimeoutMs int `` /* 157-byte string literal not displayed */ IdleTimeoutMs int `` /* 178-byte string literal not displayed */ WriteWaitMs int `` /* 156-byte string literal not displayed */ PongWaitMs int `` /* 156-byte string literal not displayed */ PingPeriodMs int `` /* 204-byte string literal not displayed */ OutgoingQueueSize int `` /* 245-byte string literal not displayed */ SSLCertificate string `` /* 192-byte string literal not displayed */ SSLPrivateKey string `` /* 192-byte string literal not displayed */ TLSCert []tls.Certificate // Created by processing SSLCertificate and SSLPrivateKey, not set from input args directly. }
SocketConfig is configuration relevant to the transport socket and protocol.
func NewSocketConfig ¶ added in v1.0.0
func NewSocketConfig() *SocketConfig
NewTransportConfig creates a new TransportConfig struct.
type Tracker ¶
type Tracker interface { SetMatchLeaveListener(func(id uuid.UUID, leaves []*MatchPresence)) Stop() // Track returns success true/false, and new presence true/false. Track(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, meta PresenceMeta, allowIfFirstForSession bool) (bool, bool) Untrack(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID) UntrackAll(sessionID uuid.UUID) // Update returns success true/false - will only fail if the user has no presence and allowIfFirstForSession is false, otherwise is an upsert. Update(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID, meta PresenceMeta, allowIfFirstForSession bool) bool // Remove all presences on a stream, effectively closing it. UntrackByStream(stream PresenceStream) // Remove all presences on a stream from the local node. UntrackLocalByStream(stream PresenceStream) // List the nodes that have at least one presence for the given stream. ListNodesForStream(stream PresenceStream) map[string]struct{} // Check if a stream exists (has any presences) or not. StreamExists(stream PresenceStream) bool // Get current total number of presences. Count() int // Get the number of presences in the given stream. CountByStream(stream PresenceStream) int // Get a snapshot of current presence counts for streams with one of the given stream modes. CountByStreamModeFilter(modes map[uint8]*uint8) map[*PresenceStream]int32 // Check if a single presence on the current node exists. GetLocalBySessionIDStreamUserID(sessionID uuid.UUID, stream PresenceStream, userID uuid.UUID) *PresenceMeta // List presences by stream, optionally include hidden ones. ListByStream(stream PresenceStream, includeHidden bool) []*Presence // Fast lookup of local session IDs to use for message delivery. ListLocalSessionIDByStream(stream PresenceStream) []uuid.UUID // Fast lookup of node + session IDs to use for message delivery. ListPresenceIDByStream(stream PresenceStream) []*PresenceID }
func StartLocalTracker ¶
Source Files ¶
- api.go
- api_account.go
- api_authenticate.go
- api_channel.go
- api_friend.go
- api_group.go
- api_leaderboard.go
- api_link.go
- api_match.go
- api_notification.go
- api_rpc.go
- api_storage.go
- api_unlink.go
- api_user.go
- config.go
- console.go
- console_gdpr.go
- core_account.go
- core_authenticate.go
- core_channel.go
- core_friend.go
- core_group.go
- core_leaderboard.go
- core_notification.go
- core_storage.go
- core_user.go
- core_wallet.go
- db.go
- leaderboard_cache.go
- logger.go
- match_handler.go
- match_registry.go
- matchmaker.go
- message_router.go
- metrics.go
- pipeline.go
- pipeline_channel.go
- pipeline_match.go
- pipeline_matchmaker.go
- pipeline_rpc.go
- pipeline_status.go
- runtime.go
- runtime_hook.go
- runtime_loadlib.go
- runtime_lua_context.go
- runtime_module_cache.go
- runtime_nakama_module.go
- runtime_oslib.go
- runtime_utils.go
- session_registry.go
- session_ws.go
- socket_ws.go
- tracker.go