Client
public protocol Client
A client for the Nakama server.
-
Declaration
Swift
var serverTime: Int
Return Value
The current server time in UTC milliseconds as reported by the server during the last heartbeat exchange. If this client has never been connected the function returns local device current UTC milliseconds.
-
This is invoked when the socket connection has been disconnected
Declaration
Swift
var onDisconnect: ((Error?) -> Void)?
-
This is invoked when there is a server error.
Declaration
Swift
var onError: ((NakamaError) -> Void)?
-
This is invoked when a new topic message is received.
Declaration
Swift
var onTopicMessage: ((TopicMessage) -> Void)?
-
This is invoked when a new topic presence update is received.
Declaration
Swift
var onTopicPresence: ((TopicPresence) -> Void)?
-
This is invoked when a new notification is received.
Declaration
Swift
var onNotification: ((Notification) -> Void)?
-
Declaration
Swift
func login(with message: AuthenticateMessage) -> Promise<Session>
Parameters
message
message The {@code AuthenticateMessage} to send to the server.
Return Value
A {@code Session} for the user.
-
Declaration
Swift
func register(with message: AuthenticateMessage) -> Promise<Session>
Parameters
message
message The {@code AuthenticateMessage} to send to the server.
Return Value
A {@code Session} for the user.
-
Parameters
session
session The {@code Session} to connect the socket with.
Return Value
Placeholder return type to allow chaining operations.
-
- Sends a disconnect request to the server. When disconnected,
onDisconnect
is invoked.
Declaration
Swift
func disconnect()
- Sends a disconnect request to the server. When disconnected,
-
- Send a logout request to the server
Declaration
Swift
func logout()
-
Declaration
Swift
func send(message: UsersFetchMessage) -> Promise<[User]>
Parameters
message
message The message to send.
Return Value
An instance of the expected return type.
-
Undocumented
Declaration
Swift
func send(message: SelfFetchMessage) -> Promise<SelfUser>
-
Undocumented
Declaration
Swift
func send(message: SelfUpdateMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: SelfLinkMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: SelfUnlinkMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: RPCMessage) -> Promise<RPCResult>
-
Undocumented
Declaration
Swift
func send(message: StorageFetchMessage) -> Promise<[StorageRecord]>
-
Undocumented
Declaration
Swift
func send(message: StorageListMessage) -> Promise<[StorageRecord]>
-
Undocumented
Declaration
Swift
func send(message: StorageRemoveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: StorageWriteMessage) -> Promise<[StorageRecordID]>
-
Undocumented
Declaration
Swift
func send(message: StorageUpdateMessage) -> Promise<[StorageRecordID]>
-
Undocumented
Declaration
Swift
func send(message: FriendAddMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: FriendBlockMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: FriendRemoveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: FriendsListMessage) -> Promise<[Friend]>
-
Undocumented
Declaration
Swift
func send(message: NotificationRemoveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: NotificationListMessage) -> Promise<[Notification]>
-
Undocumented
Declaration
Swift
func send(message: TopicJoinMessage) -> Promise<[Topic]>
-
Undocumented
Declaration
Swift
func send(message: TopicLeaveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: TopicMessageSendMessage) -> Promise<TopicMessageAck>
-
Undocumented
Declaration
Swift
func send(message: TopicMessagesListMessage) -> Promise<[TopicMessage]>
-
Undocumented
Declaration
Swift
func send(message: GroupAddUserMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupCreateMessage) -> Promise<[Group]>
-
Undocumented
Declaration
Swift
func send(message: GroupJoinMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupKickUserMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupLeaveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupPromoteUserMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupRemoveMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupsFetchMessage) -> Promise<[Group]>
-
Undocumented
Declaration
Swift
func send(message: GroupsListMessage) -> Promise<[Group]>
-
Undocumented
Declaration
Swift
func send(message: GroupsSelfListMessage) -> Promise<[GroupSelf]>
-
Undocumented
Declaration
Swift
func send(message: GroupUpdateMessage) -> Promise<Void>
-
Undocumented
Declaration
Swift
func send(message: GroupUsersListMessage) -> Promise<[GroupUser]>
-
Undocumented
Declaration
Swift
func send(message: LeaderboardRecordsFetchMessage) -> Promise<[LeaderboardRecord]>
-
Undocumented
Declaration
Swift
func send(message: LeaderboardRecordsListMessage) -> Promise<[LeaderboardRecord]>
-
Undocumented
Declaration
Swift
func send(message: LeaderboardRecordWriteMessage) -> Promise<[LeaderboardRecord]>
-
Undocumented
Declaration
Swift
func send(message: LeaderboardsListMessage) -> Promise<[Leaderboard]>
-
Declaration
Swift
func send(message: Message)
Parameters
message
message The message to send.