Nakama .NET Client SDK 3.5.0
Nakama .NET Client SDK
Loading...
Searching...
No Matches
Nakama.Socket Class Reference

A socket which implements the Nakama realtime API. More...

Inheritance diagram for Nakama.Socket:
Nakama.ISocket

Public Member Functions

 Socket ()
 A new socket with default options. More...
 
 Socket (ISocketAdapter adapter)
 A new socket with an adapter. More...
 
 Socket (string scheme, string host, int port, ISocketAdapter adapter, int sendTimeoutSec=DefaultSendTimeout)
 A new socket with server connection and adapter options. More...
 
Task AcceptPartyMemberAsync (string partyId, IUserPresence presence)
 Accept a party member's request to join the party.
Parameters
partyIdThe party ID to accept the join request for.
presenceThe presence to accept as a party member.
Returns
A task to represent the asynchronous operation.
More...
 
async Task< IMatchmakerTicketAddMatchmakerAsync (string query="*", int minCount=2, int maxCount=8, Dictionary< string, string > stringProperties=null, Dictionary< string, double > numericProperties=null, int? countMultiple=null)
 Join the matchmaker pool and search for opponents on the server.
Parameters
queryThe matchmaker query to search for opponents.
minCountThe minimum number of players to compete against in a match.
maxCountThe maximum number of players to compete against in a match.
stringPropertiesA set of key/value properties to provide to searches.
numericPropertiesA set of key/value numeric properties to provide to searches.
countMultipleAn optional integer to force the matchmaker to match in multiples of.
Returns
A task which resolves to a matchmaker ticket object.
More...
 
async Task< IPartyMatchmakerTicketAddMatchmakerPartyAsync (string partyId, string query, int minCount, int maxCount, Dictionary< string, string > stringProperties=null, Dictionary< string, double > numericProperties=null, int? countMultiple=null)
 Begin matchmaking as a party.
Parameters
partyIdParty ID.
queryFilter query used to identify suitable users.
minCountMinimum total user count to match together.
maxCountMaximum total user count to match together.
stringPropertiesString properties.
numericPropertiesNumeric properties.
countMultipleAn optional integer to force the matchmaker to match in multiples of.
Returns
A task which resolves to a party matchmaker ticket object.
More...
 
Task CloseAsync ()
 Close the socket connection to the server.
Returns
A task to represent the asynchronous operation.
More...
 
Task ConnectAsync (ISession session, bool appearOnline=false, int connectTimeoutSec=DefaultConnectTimeout, string langTag="en")
 Connect to the server.
Parameters
sessionThe session of the user.
appearOnlineIf the user who appear online to other users.
connectTimeoutThe time allowed for the socket connection to be established.
langTagThe language tag of the user on the connected socket.
Returns
A task to represent the asynchronous operation.
More...
 
Task ClosePartyAsync (string partyId)
 End a party, kicking all party members and closing it.
Parameters
partyIdThe ID of the party.
Returns
A task to represent the asynchronous operation.
More...
 
async Task< IMatchCreateMatchAsync (string name=null)
 Create a multiplayer match on the server.
Returns
A task to represent the asynchronous operation.
More...
 
async Task< IPartyCreatePartyAsync (bool open, int maxSize)
 Create a party.
Parameters
openWhether or not the party will require join requests to be approved by the party leader.
maxSizeMaximum number of party members.
Returns
A task to represent the asynchronous operation.
More...
 
Task< IStatusFollowUsersAsync (IEnumerable< IApiUser > users)
 Subscribe to one or more users for their status updates.
Parameters
usersThe users.
Returns
A task which resolves to the current statuses for the users.
More...
 
async Task< IStatusFollowUsersAsync (IEnumerable< string > userIDs, IEnumerable< string > usernames=null)
 Subscribe to one or more users for their status updates.
Parameters
userIDsThe IDs of users.
usernamesThe usernames of the users.
Returns
A task which resolves to the current statuses for the users.
More...
 
async Task< IChannelJoinChatAsync (string target, ChannelType type, bool persistence=false, bool hidden=false)
 Join a chat channel on the server.
Parameters
targetThe target channel to join.
typeThe type of channel to join.
persistenceIf chat messages should be stored.
hiddenIf the current user should be hidden on the channel.
Returns
A task which resolves to a chat channel object.
More...
 
async Task< IMatchJoinMatchAsync (IMatchmakerMatched matched)
 Join a multiplayer match with the matchmaker matched object.
Parameters
matchedA matchmaker matched object.
Returns
A task which resolves to a multiplayer match.
More...
 
async Task< IMatchJoinMatchAsync (string matchId, IDictionary< string, string > metadata=null)
 Join a multiplayer match by ID.
Parameters
matchIdThe ID of the match to attempt to join.
metadataAn optional set of key-value metadata pairs to be passed to the match handler.
Returns
A task which resolves to a multiplayer match.
More...
 
Task JoinPartyAsync (string partyId)
 Join a party.
Parameters
partyIdParty ID
Returns
A task to represent the asynchronous operation.
More...
 
Task LeaveChatAsync (IChannel channel)
 Leave a chat channel on the server.
Parameters
channelThe chat channel to leave.
Returns
A task which represents the asynchronous operation.
More...
 
Task LeaveChatAsync (string channelId)
 Leave a chat channel on the server.
Parameters
channelIdThe ID of the chat channel to leave.
Returns
A task which represents the asynchronous operation.
More...
 
Task LeaveMatchAsync (IMatch match)
 Leave a multiplayer match on the server.
Parameters
matchThe multiplayer match to leave.
Returns
A task which represents the asynchronous operation.
More...
 
Task LeaveMatchAsync (string matchId)
 Leave a multiplayer match on the server.
Parameters
matchIdThe multiplayer match to leave.
Returns
A task which represents the asynchronous operation.
More...
 
Task LeavePartyAsync (string partyId)
 Leave the party.
Parameters
partyIdParty ID.
Returns
A task to represent the asynchronous operation.
More...
 
async Task< IPartyJoinRequestListPartyJoinRequestsAsync (string partyId)
 Request a list of pending join requests for a party.
Parameters
partyIdParty ID.
Returns
A task which resolves to a list of all party join requests.
More...
 
Task PromotePartyMemberAsync (string partyId, IUserPresence partyMember)
 Promote a new party leader.
Parameters
partyIdParty ID.
partyMemberThe presence of an existing party member to promote as the new leader.
Returns
A task which resolves to an announcement of a new party leader.
More...
 
Task< IChannelMessageAckRemoveChatMessageAsync (IChannel channel, string messageId)
 Remove a chat message from a chat channel on the server.
Parameters
channelThe chat channel with the message to remove.
messageIdThe ID of the chat message to remove.
Returns
A task which resolves to an acknowledgement of the removed message.
More...
 
async Task< IChannelMessageAckRemoveChatMessageAsync (string channelId, string messageId)
 Remove a chat message from a chat channel on the server.
Parameters
channelIdThe ID of the chat channel with the message to remove.
messageIdThe ID of the chat message to remove.
Returns
A task which resolves to an acknowledgement of the removed message.
More...
 
Task RemoveMatchmakerAsync (IMatchmakerTicket ticket)
 Leave the matchmaker pool with the ticket.
Parameters
ticketThe ticket returned by the matchmaker on join.
Returns
A task which represents the asynchronous operation.
More...
 
Task RemoveMatchmakerAsync (string ticket)
 Leave the matchmaker pool with the ticket contents.
Parameters
ticketThe contents of the ticket returned by the matchmaker on join.
Returns
A task which represents the asynchronous operation.
More...
 
Task RemoveMatchmakerPartyAsync (string partyId, string ticket)
 Cancel a party matchmaking process using a ticket.
Parameters
partyIdParty ID.
ticketThe ticket to cancel.
Returns
A task which represents the asynchronous operation.
More...
 
Task RemovePartyMemberAsync (string partyId, IUserPresence presence)
 Kick a party member, or decline a request to join.
Parameters
partyIdParty ID to remove/reject from.
presenceThe presence to remove or reject.
Returns
A task which represents the asynchronous operation.
More...
 
async Task< IApiRpcRpcAsync (string funcId, string payload=null)
 Execute an RPC function to the server.
Parameters
funcIdThe ID of the function to execute.
payloadAn (optional) payload to send to the server.
Returns
A task which resolves to the RPC function response object.
More...
 
async Task< IApiRpcRpcAsync (string funcId, ArraySegment< byte > payload)
 Execute an RPC function to the server.
Parameters
funcIdThe ID of the function to execute.
payloadAn (optional) payload sent to the server from the byte buffer.
Returns
A task which resolves to the RPC function response object.
More...
 
Task SendMatchStateAsync (string matchId, long opCode, ArraySegment< byte > state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server.
Parameters
matchIdThe ID of the match.
opCodeAn operation code for the input.
stateThe input data to send from the byte buffer.
presencesThe presences in the match who should receive the input.
Returns
A task which represents the asynchronous operation.
More...
 
Task SendMatchStateAsync (string matchId, long opCode, string state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server. /// When no presences are supplied the new match state will be sent to all presences. More...
 
Task SendMatchStateAsync (string matchId, long opCode, byte[] state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server. /// When no presences are supplied the new match state will be sent to all presences. More...
 
Task SendPartyDataAsync (string partyId, long opCode, ArraySegment< byte > data)
 Send data to a party.
Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataThe input data to send from the byte buffer, if any.
Returns
A task which represents the asynchronous operation.
More...
 
Task SendPartyDataAsync (string partyId, long opCode, string data)
 Send data to a party.
Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataData payload, if any.
Returns
A task which represents the asynchronous operation.
More...
 
Task SendPartyDataAsync (string partyId, long opCode, byte[] data)
 Send data to a party.
Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataData payload, if any.
Returns
A task which represents the asynchronous operation.
More...
 
override string ToString ()
 
Task UnfollowUsersAsync (IEnumerable< IApiUser > users)
 Unfollow one or more users from their status updates.
Parameters
usersThe users to unfollow.
Returns
A task which represents the asynchronous operation.
More...
 
Task UnfollowUsersAsync (IEnumerable< string > userIDs)
 Unfollow one or more users from their status updates.
Parameters
userIDsThe IDs of the users to unfollow.
Returns
A task which represents the asynchronous operation.
More...
 
Task< IChannelMessageAckUpdateChatMessageAsync (IChannel channel, string messageId, string content)
 Update a chat message on a chat channel in the server.
Parameters
channelThe chat channel with the message to update.
messageIdThe ID of the message to update.
contentThe new contents of the chat message.
Returns
A task which resolves to an acknowledgement of the updated message.
More...
 
async Task< IChannelMessageAckUpdateChatMessageAsync (string channelId, string messageId, string content)
 Update a chat message on a chat channel in the server.
Parameters
channelIdThe ID of the chat channel with the message to update.
messageIdThe ID of the message to update.
contentThe new contents of the chat message.
Returns
A task which resolves to an acknowledgement of the updated message.
More...
 
Task UpdateStatusAsync (string status)
 Update the status for the current user online.
Parameters
statusThe new status for the user.
Returns
A task which represents the asynchronous operation.
More...
 
Task< IChannelMessageAckWriteChatMessageAsync (IChannel channel, string content)
 Send a chat message to a chat channel on the server.
Parameters
channelThe chat channel to send onto.
contentThe contents of the message to send.
Returns
A task which resolves to the acknowledgement of the chat message write.
More...
 
async Task< IChannelMessageAckWriteChatMessageAsync (string channelId, string content)
 Send a chat message to a chat channel on the server.
Parameters
channelIdThe ID of the chat channel to send onto.
contentThe contents of the message to send.
Returns
A task which resolves to the acknowledgement of the chat message write.
More...
 
Task AcceptPartyMemberAsync (string partyId, IUserPresence presence)
 Accept a party member's request to join the party. More...
 
Task< IMatchmakerTicketAddMatchmakerAsync (string query="*", int minCount=2, int maxCount=8, Dictionary< string, string > stringProperties=null, Dictionary< string, double > numericProperties=null, int? countMultiple=null)
 Join the matchmaker pool and search for opponents on the server. More...
 
Task< IPartyMatchmakerTicketAddMatchmakerPartyAsync (string partyId, string query, int minCount, int maxCount, Dictionary< string, string > stringProperties=null, Dictionary< string, double > numericProperties=null, int? countMultiple=null)
 Begin matchmaking as a party. More...
 
Task ClosePartyAsync (string partyId)
 End a party, kicking all party members and closing it. More...
 
Task CloseAsync ()
 Close the socket connection to the server. More...
 
Task ConnectAsync (ISession session, bool appearOnline=false, int connectTimeout=Socket.DefaultConnectTimeout, string langTag="en")
 Connect to the server. More...
 
Task< IMatchCreateMatchAsync (string matchName=null)
 Create a multiplayer match on the server. More...
 
Task< IPartyCreatePartyAsync (bool open, int maxSize)
 Create a party. More...
 
Task< IStatusFollowUsersAsync (IEnumerable< IApiUser > users)
 Subscribe to one or more users for their status updates. More...
 
Task< IStatusFollowUsersAsync (IEnumerable< string > userIDs, IEnumerable< string > usernames=null)
 Subscribe to one or more users for their status updates. More...
 
Task< IChannelJoinChatAsync (string target, ChannelType type, bool persistence=false, bool hidden=false)
 Join a chat channel on the server. More...
 
Task JoinPartyAsync (string partyId)
 Join a party. More...
 
Task< IMatchJoinMatchAsync (IMatchmakerMatched matched)
 Join a multiplayer match with the matchmaker matched object. More...
 
Task< IMatchJoinMatchAsync (string matchId, IDictionary< string, string > metadata=null)
 Join a multiplayer match by ID. More...
 
Task LeaveChatAsync (IChannel channel)
 Leave a chat channel on the server. More...
 
Task LeaveChatAsync (string channelId)
 Leave a chat channel on the server. More...
 
Task LeaveMatchAsync (IMatch match)
 Leave a multiplayer match on the server. More...
 
Task LeaveMatchAsync (string matchId)
 Leave a multiplayer match on the server. More...
 
Task LeavePartyAsync (string partyId)
 Leave the party. More...
 
Task< IPartyJoinRequestListPartyJoinRequestsAsync (string partyId)
 Request a list of pending join requests for a party. More...
 
Task PromotePartyMemberAsync (string partyId, IUserPresence partyMember)
 Promote a new party leader. More...
 
Task< IChannelMessageAckRemoveChatMessageAsync (IChannel channel, string messageId)
 Remove a chat message from a chat channel on the server. More...
 
Task< IChannelMessageAckRemoveChatMessageAsync (string channelId, string messageId)
 Remove a chat message from a chat channel on the server. More...
 
Task RemoveMatchmakerAsync (IMatchmakerTicket ticket)
 Leave the matchmaker pool with the ticket. More...
 
Task RemoveMatchmakerAsync (string ticket)
 Leave the matchmaker pool with the ticket contents. More...
 
Task RemoveMatchmakerPartyAsync (string partyId, string ticket)
 Cancel a party matchmaking process using a ticket. More...
 
Task RemovePartyMemberAsync (string partyId, IUserPresence presence)
 Kick a party member, or decline a request to join. More...
 
Task< IApiRpcRpcAsync (string funcId, string payload=null)
 Execute an RPC function to the server. More...
 
Task< IApiRpcRpcAsync (string funcId, ArraySegment< byte > payload)
 Execute an RPC function to the server. More...
 
Task SendMatchStateAsync (string matchId, long opCode, string state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server. More...
 
Task SendMatchStateAsync (string matchId, long opCode, ArraySegment< byte > state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server. More...
 
Task SendMatchStateAsync (string matchId, long opCode, byte[] state, IEnumerable< IUserPresence > presences=null)
 Send input to a multiplayer match on the server. More...
 
Task SendPartyDataAsync (string partyId, long opCode, ArraySegment< byte > data)
 Send data to a party. More...
 
Task SendPartyDataAsync (string partyId, long opCode, string data)
 Send data to a party. More...
 
Task SendPartyDataAsync (string partyId, long opCode, byte[] data)
 Send data to a party. More...
 
Task UnfollowUsersAsync (IEnumerable< IApiUser > users)
 Unfollow one or more users from their status updates. More...
 
Task UnfollowUsersAsync (IEnumerable< string > userIDs)
 Unfollow one or more users from their status updates. More...
 
Task< IChannelMessageAckUpdateChatMessageAsync (IChannel channel, string messageId, string content)
 Update a chat message on a chat channel in the server. More...
 
Task< IChannelMessageAckUpdateChatMessageAsync (string channelId, string messageId, string content)
 Update a chat message on a chat channel in the server. More...
 
Task UpdateStatusAsync (string status)
 Update the status for the current user online. More...
 
Task< IChannelMessageAckWriteChatMessageAsync (IChannel channel, string content)
 Send a chat message to a chat channel on the server. More...
 
Task< IChannelMessageAckWriteChatMessageAsync (string channelId, string content)
 Send a chat message to a chat channel on the server. More...
 

Static Public Member Functions

static ISocket From (IClient client)
 Build a socket from a client object. More...
 
static ISocket From (IClient client, ISocketAdapter adapter)
 Build a socket from a client object and socket adapter. More...
 

Static Public Attributes

const int DefaultConnectTimeout = 30
 The default timeout for when the socket connects. More...
 
const int DefaultSendTimeout = 10
 The default timeout for when the socket sends a message. More...
 

Properties

bool IsConnected [get]
 If the socket is connected. More...
 
bool IsConnecting [get]
 If the socket is connecting. More...
 
ILogger Logger [get, set]
 The logger to use with the socket. More...
 
- Properties inherited from Nakama.ISocket
bool IsConnected [get]
 If the socket is connected. More...
 
bool IsConnecting [get]
 If the socket is connecting. More...
 

Events

Action Closed
 
Action Connected
 
Action< IApiChannelMessageReceivedChannelMessage
 
Action< IChannelPresenceEventReceivedChannelPresence
 
Action< Exception > ReceivedError
 
Action< IMatchmakerMatchedReceivedMatchmakerMatched
 
Action< IMatchStateReceivedMatchState
 
Action< IMatchPresenceEventReceivedMatchPresence
 
Action< IApiNotificationReceivedNotification
 
Action< IStatusPresenceEventReceivedStatusPresence
 
Action< IStreamPresenceEventReceivedStreamPresence
 
Action< IStreamStateReceivedStreamState
 
Action< IPartyReceivedParty
 
Action< IPartyCloseReceivedPartyClose
 
Action< IPartyDataReceivedPartyData
 
Action< IPartyJoinRequestReceivedPartyJoinRequest
 
Action< IPartyLeaderReceivedPartyLeader
 
Action< IPartyPresenceEventReceivedPartyPresence
 
Action< IPartyMatchmakerTicketReceivedPartyMatchmakerTicket
 
- Events inherited from Nakama.ISocket
Action Closed
 Received when a socket is closed. More...
 
Action Connected
 Received when a socket is connected. More...
 
Action< IApiChannelMessageReceivedChannelMessage
 Received a chat channel message. More...
 
Action< IChannelPresenceEventReceivedChannelPresence
 Received a presence change for joins and leaves with users in a chat channel. More...
 
Action< Exception > ReceivedError
 Received when an error occurs on the socket. More...
 
Action< IMatchmakerMatchedReceivedMatchmakerMatched
 Received a matchmaker matched message. More...
 
Action< IMatchStateReceivedMatchState
 Received a message from a multiplayer match. More...
 
Action< IMatchPresenceEventReceivedMatchPresence
 Received a presence change for joins and leaves of users in a multiplayer match. More...
 
Action< IApiNotificationReceivedNotification
 Received a notification for the current user. More...
 
Action< IPartyReceivedParty
 Received a party event. This will occur when the current user's invitation request is accepted by the party leader of a closed party. More...
 
Action< IPartyCloseReceivedPartyClose
 Received a party close event. More...
 
Action< IPartyDataReceivedPartyData
 Received custom party data. More...
 
Action< IPartyJoinRequestReceivedPartyJoinRequest
 Received a request to join the party. More...
 
Action< IPartyLeaderReceivedPartyLeader
 Received a change in the party leader. More...
 
Action< IPartyMatchmakerTicketReceivedPartyMatchmakerTicket
 Received a new matchmaker ticket for the party. More...
 
Action< IPartyPresenceEventReceivedPartyPresence
 Received a new presence event in the party. More...
 
Action< IStatusPresenceEventReceivedStatusPresence
 Received a presence change for when a user updated their online status. More...
 
Action< IStreamPresenceEventReceivedStreamPresence
 Received a presence change for joins and leaves on a realtime stream. More...
 
Action< IStreamStateReceivedStreamState
 Received a message from a realtime stream. More...
 

Detailed Description

A socket which implements the Nakama realtime API.

Constructor & Destructor Documentation

◆ Socket() [1/3]

Nakama.Socket.Socket ( )
inline

A new socket with default options.

◆ Socket() [2/3]

Nakama.Socket.Socket ( ISocketAdapter  adapter)
inline

A new socket with an adapter.

Parameters
adapterThe adapter for use with the socket.

◆ Socket() [3/3]

Nakama.Socket.Socket ( string  scheme,
string  host,
int  port,
ISocketAdapter  adapter,
int  sendTimeoutSec = DefaultSendTimeout 
)
inline

A new socket with server connection and adapter options.

Parameters
schemeThe protocol scheme. Must be "ws" or "wss".
hostThe host address of the server.
portThe port number of the server.
adapterThe adapter for use with the socket.
sendTimeoutSecThe maximum time allowed for a message to be sent.

Member Function Documentation

◆ AcceptPartyMemberAsync()

Task Nakama.Socket.AcceptPartyMemberAsync ( string  partyId,
IUserPresence  presence 
)
inline

Accept a party member's request to join the party.

Parameters
partyIdThe party ID to accept the join request for.
presenceThe presence to accept as a party member.
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ AddMatchmakerAsync()

async Task< IMatchmakerTicket > Nakama.Socket.AddMatchmakerAsync ( string  query = "*",
int  minCount = 2,
int  maxCount = 8,
Dictionary< string, string >  stringProperties = null,
Dictionary< string, double >  numericProperties = null,
int?  countMultiple = null 
)
inline

Join the matchmaker pool and search for opponents on the server.

Parameters
queryThe matchmaker query to search for opponents.
minCountThe minimum number of players to compete against in a match.
maxCountThe maximum number of players to compete against in a match.
stringPropertiesA set of key/value properties to provide to searches.
numericPropertiesA set of key/value numeric properties to provide to searches.
countMultipleAn optional integer to force the matchmaker to match in multiples of.
Returns
A task which resolves to a matchmaker ticket object.

Implements Nakama.ISocket.

◆ AddMatchmakerPartyAsync()

async Task< IPartyMatchmakerTicket > Nakama.Socket.AddMatchmakerPartyAsync ( string  partyId,
string  query,
int  minCount,
int  maxCount,
Dictionary< string, string >  stringProperties = null,
Dictionary< string, double >  numericProperties = null,
int?  countMultiple = null 
)
inline

Begin matchmaking as a party.

Parameters
partyIdParty ID.
queryFilter query used to identify suitable users.
minCountMinimum total user count to match together.
maxCountMaximum total user count to match together.
stringPropertiesString properties.
numericPropertiesNumeric properties.
countMultipleAn optional integer to force the matchmaker to match in multiples of.
Returns
A task which resolves to a party matchmaker ticket object.

Implements Nakama.ISocket.

◆ CloseAsync()

Task Nakama.Socket.CloseAsync ( )

Close the socket connection to the server.

Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ ClosePartyAsync()

Task Nakama.Socket.ClosePartyAsync ( string  partyId)
inline

End a party, kicking all party members and closing it.

Parameters
partyIdThe ID of the party.
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ ConnectAsync()

Task Nakama.Socket.ConnectAsync ( ISession  session,
bool  appearOnline = false,
int  connectTimeoutSec = DefaultConnectTimeout,
string  langTag = "en" 
)
inline

Connect to the server.

Parameters
sessionThe session of the user.
appearOnlineIf the user who appear online to other users.
connectTimeoutThe time allowed for the socket connection to be established.
langTagThe language tag of the user on the connected socket.
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ CreateMatchAsync()

async Task< IMatch > Nakama.Socket.CreateMatchAsync ( string  name = null)
inline

Create a multiplayer match on the server.

Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ CreatePartyAsync()

async Task< IParty > Nakama.Socket.CreatePartyAsync ( bool  open,
int  maxSize 
)
inline

Create a party.

Parameters
openWhether or not the party will require join requests to be approved by the party leader.
maxSizeMaximum number of party members.
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ FollowUsersAsync() [1/2]

Task< IStatus > Nakama.Socket.FollowUsersAsync ( IEnumerable< IApiUser users)

Subscribe to one or more users for their status updates.

Parameters
usersThe users.
Returns
A task which resolves to the current statuses for the users.

Implements Nakama.ISocket.

◆ FollowUsersAsync() [2/2]

async Task< IStatus > Nakama.Socket.FollowUsersAsync ( IEnumerable< string >  userIDs,
IEnumerable< string >  usernames = null 
)
inline

Subscribe to one or more users for their status updates.

Parameters
userIDsThe IDs of users.
usernamesThe usernames of the users.
Returns
A task which resolves to the current statuses for the users.

Implements Nakama.ISocket.

◆ From() [1/2]

static ISocket Nakama.Socket.From ( IClient  client)
static

Build a socket from a client object.

Parameters
clientA client object.
Returns
A new socket with the connection settings from the client.

◆ From() [2/2]

static ISocket Nakama.Socket.From ( IClient  client,
ISocketAdapter  adapter 
)
inlinestatic

Build a socket from a client object and socket adapter.

Parameters
clientA client object.
adapterThe socket adapter to use with the connection.
Returns
A new socket with connection settings from the client.

◆ JoinChatAsync()

async Task< IChannel > Nakama.Socket.JoinChatAsync ( string  target,
ChannelType  type,
bool  persistence = false,
bool  hidden = false 
)
inline

Join a chat channel on the server.

Parameters
targetThe target channel to join.
typeThe type of channel to join.
persistenceIf chat messages should be stored.
hiddenIf the current user should be hidden on the channel.
Returns
A task which resolves to a chat channel object.

Implements Nakama.ISocket.

◆ JoinMatchAsync() [1/2]

async Task< IMatch > Nakama.Socket.JoinMatchAsync ( IMatchmakerMatched  matched)
inline

Join a multiplayer match with the matchmaker matched object.

Parameters
matchedA matchmaker matched object.
Returns
A task which resolves to a multiplayer match.

Implements Nakama.ISocket.

◆ JoinMatchAsync() [2/2]

async Task< IMatch > Nakama.Socket.JoinMatchAsync ( string  matchId,
IDictionary< string, string >  metadata = null 
)
inline

Join a multiplayer match by ID.

Parameters
matchIdThe ID of the match to attempt to join.
metadataAn optional set of key-value metadata pairs to be passed to the match handler.
Returns
A task which resolves to a multiplayer match.

Implements Nakama.ISocket.

◆ JoinPartyAsync()

Task Nakama.Socket.JoinPartyAsync ( string  partyId)
inline

Join a party.

Parameters
partyIdParty ID
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ LeaveChatAsync() [1/2]

Task Nakama.Socket.LeaveChatAsync ( IChannel  channel)

Leave a chat channel on the server.

Parameters
channelThe chat channel to leave.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ LeaveChatAsync() [2/2]

Task Nakama.Socket.LeaveChatAsync ( string  channelId)
inline

Leave a chat channel on the server.

Parameters
channelIdThe ID of the chat channel to leave.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ LeaveMatchAsync() [1/2]

Task Nakama.Socket.LeaveMatchAsync ( IMatch  match)

Leave a multiplayer match on the server.

Parameters
matchThe multiplayer match to leave.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ LeaveMatchAsync() [2/2]

Task Nakama.Socket.LeaveMatchAsync ( string  matchId)
inline

Leave a multiplayer match on the server.

Parameters
matchIdThe multiplayer match to leave.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ LeavePartyAsync()

Task Nakama.Socket.LeavePartyAsync ( string  partyId)
inline

Leave the party.

Parameters
partyIdParty ID.
Returns
A task to represent the asynchronous operation.

Implements Nakama.ISocket.

◆ ListPartyJoinRequestsAsync()

async Task< IPartyJoinRequest > Nakama.Socket.ListPartyJoinRequestsAsync ( string  partyId)
inline

Request a list of pending join requests for a party.

Parameters
partyIdParty ID.
Returns
A task which resolves to a list of all party join requests.

Implements Nakama.ISocket.

◆ PromotePartyMemberAsync()

Task Nakama.Socket.PromotePartyMemberAsync ( string  partyId,
IUserPresence  partyMember 
)
inline

Promote a new party leader.

Parameters
partyIdParty ID.
partyMemberThe presence of an existing party member to promote as the new leader.
Returns
A task which resolves to an announcement of a new party leader.

Implements Nakama.ISocket.

◆ RemoveChatMessageAsync() [1/2]

Task< IChannelMessageAck > Nakama.Socket.RemoveChatMessageAsync ( IChannel  channel,
string  messageId 
)

Remove a chat message from a chat channel on the server.

Parameters
channelThe chat channel with the message to remove.
messageIdThe ID of the chat message to remove.
Returns
A task which resolves to an acknowledgement of the removed message.

Implements Nakama.ISocket.

◆ RemoveChatMessageAsync() [2/2]

async Task< IChannelMessageAck > Nakama.Socket.RemoveChatMessageAsync ( string  channelId,
string  messageId 
)
inline

Remove a chat message from a chat channel on the server.

Parameters
channelIdThe ID of the chat channel with the message to remove.
messageIdThe ID of the chat message to remove.
Returns
A task which resolves to an acknowledgement of the removed message.

Implements Nakama.ISocket.

◆ RemoveMatchmakerAsync() [1/2]

Task Nakama.Socket.RemoveMatchmakerAsync ( IMatchmakerTicket  ticket)

Leave the matchmaker pool with the ticket.

Parameters
ticketThe ticket returned by the matchmaker on join.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ RemoveMatchmakerAsync() [2/2]

Task Nakama.Socket.RemoveMatchmakerAsync ( string  ticket)
inline

Leave the matchmaker pool with the ticket contents.

Parameters
ticketThe contents of the ticket returned by the matchmaker on join.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ RemoveMatchmakerPartyAsync()

Task Nakama.Socket.RemoveMatchmakerPartyAsync ( string  partyId,
string  ticket 
)
inline

Cancel a party matchmaking process using a ticket.

Parameters
partyIdParty ID.
ticketThe ticket to cancel.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ RemovePartyMemberAsync()

Task Nakama.Socket.RemovePartyMemberAsync ( string  partyId,
IUserPresence  presence 
)
inline

Kick a party member, or decline a request to join.

Parameters
partyIdParty ID to remove/reject from.
presenceThe presence to remove or reject.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ RpcAsync() [1/2]

async Task< IApiRpc > Nakama.Socket.RpcAsync ( string  funcId,
ArraySegment< byte >  payload 
)
inline

Execute an RPC function to the server.

Parameters
funcIdThe ID of the function to execute.
payloadAn (optional) payload sent to the server from the byte buffer.
Returns
A task which resolves to the RPC function response object.

Implements Nakama.ISocket.

◆ RpcAsync() [2/2]

async Task< IApiRpc > Nakama.Socket.RpcAsync ( string  funcId,
string  payload = null 
)
inline

Execute an RPC function to the server.

Parameters
funcIdThe ID of the function to execute.
payloadAn (optional) payload to send to the server.
Returns
A task which resolves to the RPC function response object.

Implements Nakama.ISocket.

◆ SendMatchStateAsync() [1/3]

Task Nakama.Socket.SendMatchStateAsync ( string  matchId,
long  opCode,
ArraySegment< byte >  state,
IEnumerable< IUserPresence presences = null 
)
inline

Send input to a multiplayer match on the server.

Parameters
matchIdThe ID of the match.
opCodeAn operation code for the input.
stateThe input data to send from the byte buffer.
presencesThe presences in the match who should receive the input.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ SendMatchStateAsync() [2/3]

Task Nakama.Socket.SendMatchStateAsync ( string  matchId,
long  opCode,
byte[]  state,
IEnumerable< IUserPresence presences = null 
)
inline

Send input to a multiplayer match on the server. /// When no presences are supplied the new match state will be sent to all presences.

Implements Nakama.ISocket.

◆ SendMatchStateAsync() [3/3]

Task Nakama.Socket.SendMatchStateAsync ( string  matchId,
long  opCode,
string  state,
IEnumerable< IUserPresence presences = null 
)

Send input to a multiplayer match on the server. /// When no presences are supplied the new match state will be sent to all presences.

Implements Nakama.ISocket.

◆ SendPartyDataAsync() [1/3]

Task Nakama.Socket.SendPartyDataAsync ( string  partyId,
long  opCode,
ArraySegment< byte >  data 
)
inline

Send data to a party.

Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataThe input data to send from the byte buffer, if any.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ SendPartyDataAsync() [2/3]

Task Nakama.Socket.SendPartyDataAsync ( string  partyId,
long  opCode,
byte[]  data 
)
inline

Send data to a party.

Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataData payload, if any.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ SendPartyDataAsync() [3/3]

Task Nakama.Socket.SendPartyDataAsync ( string  partyId,
long  opCode,
string  data 
)

Send data to a party.

Parameters
partyIdParty ID to send to.
opCodeOp code value.
dataData payload, if any.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ ToString()

override string Nakama.Socket.ToString ( )
inline

◆ UnfollowUsersAsync() [1/2]

Task Nakama.Socket.UnfollowUsersAsync ( IEnumerable< IApiUser users)

Unfollow one or more users from their status updates.

Parameters
usersThe users to unfollow.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ UnfollowUsersAsync() [2/2]

Task Nakama.Socket.UnfollowUsersAsync ( IEnumerable< string >  userIDs)
inline

Unfollow one or more users from their status updates.

Parameters
userIDsThe IDs of the users to unfollow.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ UpdateChatMessageAsync() [1/2]

Task< IChannelMessageAck > Nakama.Socket.UpdateChatMessageAsync ( IChannel  channel,
string  messageId,
string  content 
)

Update a chat message on a chat channel in the server.

Parameters
channelThe chat channel with the message to update.
messageIdThe ID of the message to update.
contentThe new contents of the chat message.
Returns
A task which resolves to an acknowledgement of the updated message.

Implements Nakama.ISocket.

◆ UpdateChatMessageAsync() [2/2]

async Task< IChannelMessageAck > Nakama.Socket.UpdateChatMessageAsync ( string  channelId,
string  messageId,
string  content 
)
inline

Update a chat message on a chat channel in the server.

Parameters
channelIdThe ID of the chat channel with the message to update.
messageIdThe ID of the message to update.
contentThe new contents of the chat message.
Returns
A task which resolves to an acknowledgement of the updated message.

Implements Nakama.ISocket.

◆ UpdateStatusAsync()

Task Nakama.Socket.UpdateStatusAsync ( string  status)
inline

Update the status for the current user online.

Parameters
statusThe new status for the user.
Returns
A task which represents the asynchronous operation.

Implements Nakama.ISocket.

◆ WriteChatMessageAsync() [1/2]

Task< IChannelMessageAck > Nakama.Socket.WriteChatMessageAsync ( IChannel  channel,
string  content 
)

Send a chat message to a chat channel on the server.

Parameters
channelThe chat channel to send onto.
contentThe contents of the message to send.
Returns
A task which resolves to the acknowledgement of the chat message write.

Implements Nakama.ISocket.

◆ WriteChatMessageAsync() [2/2]

async Task< IChannelMessageAck > Nakama.Socket.WriteChatMessageAsync ( string  channelId,
string  content 
)
inline

Send a chat message to a chat channel on the server.

Parameters
channelIdThe ID of the chat channel to send onto.
contentThe contents of the message to send.
Returns
A task which resolves to the acknowledgement of the chat message write.

Implements Nakama.ISocket.

Member Data Documentation

◆ DefaultConnectTimeout

const int Nakama.Socket.DefaultConnectTimeout = 30
static

The default timeout for when the socket connects.

◆ DefaultSendTimeout

const int Nakama.Socket.DefaultSendTimeout = 10
static

The default timeout for when the socket sends a message.

Property Documentation

◆ IsConnected

bool Nakama.Socket.IsConnected
get

If the socket is connected.

Implements Nakama.ISocket.

◆ IsConnecting

bool Nakama.Socket.IsConnecting
get

If the socket is connecting.

Implements Nakama.ISocket.

◆ Logger

ILogger Nakama.Socket.Logger
getset

The logger to use with the socket.

Event Documentation

◆ Closed

Action Nakama.Socket.Closed

◆ Connected

Action Nakama.Socket.Connected

◆ ReceivedChannelMessage

Action<IApiChannelMessage> Nakama.Socket.ReceivedChannelMessage

◆ ReceivedChannelPresence

Action<IChannelPresenceEvent> Nakama.Socket.ReceivedChannelPresence

◆ ReceivedError

Action<Exception> Nakama.Socket.ReceivedError

◆ ReceivedMatchmakerMatched

Action<IMatchmakerMatched> Nakama.Socket.ReceivedMatchmakerMatched

◆ ReceivedMatchPresence

Action<IMatchPresenceEvent> Nakama.Socket.ReceivedMatchPresence

◆ ReceivedMatchState

Action<IMatchState> Nakama.Socket.ReceivedMatchState

◆ ReceivedNotification

Action<IApiNotification> Nakama.Socket.ReceivedNotification

◆ ReceivedParty

Action<IParty> Nakama.Socket.ReceivedParty

◆ ReceivedPartyClose

Action<IPartyClose> Nakama.Socket.ReceivedPartyClose

◆ ReceivedPartyData

Action<IPartyData> Nakama.Socket.ReceivedPartyData

◆ ReceivedPartyJoinRequest

Action<IPartyJoinRequest> Nakama.Socket.ReceivedPartyJoinRequest

◆ ReceivedPartyLeader

Action<IPartyLeader> Nakama.Socket.ReceivedPartyLeader

◆ ReceivedPartyMatchmakerTicket

Action<IPartyMatchmakerTicket> Nakama.Socket.ReceivedPartyMatchmakerTicket

◆ ReceivedPartyPresence

Action<IPartyPresenceEvent> Nakama.Socket.ReceivedPartyPresence

◆ ReceivedStatusPresence

Action<IStatusPresenceEvent> Nakama.Socket.ReceivedStatusPresence

◆ ReceivedStreamPresence

Action<IStreamPresenceEvent> Nakama.Socket.ReceivedStreamPresence

◆ ReceivedStreamState

Action<IStreamState> Nakama.Socket.ReceivedStreamState


The documentation for this class was generated from the following file: