A socket connection to Nakama server.

Hierarchy

  • Socket

Implemented by

Properties

onchannelmessage: ((channelMessage: ChannelMessage) => void)

Type declaration

    • (channelMessage: ChannelMessage): void
    • Receive channel message.

      Parameters

      • channelMessage: ChannelMessage

      Returns void

onchannelpresence: ((channelPresence: ChannelPresenceEvent) => void)

Type declaration

ondisconnect: ((evt: Event) => void)

Type declaration

    • (evt: Event): void
    • Handle disconnect events received from the socket.

      Parameters

      • evt: Event

      Returns void

onerror: ((evt: Event) => void)

Type declaration

    • (evt: Event): void
    • Handle error events received from the socket.

      Parameters

      • evt: Event

      Returns void

onheartbeattimeout: (() => void)

Type declaration

    • (): void
    • An application-level heartbeat timeout that fires after the client does not receive a pong from the server after the heartbeat interval. Most browsers maintain an internal heartbeat, in which case its unlikely you'll need to use this callback. However, Chrome does not implement an internal heartbeat. We fire this separately from onclose because heartbeats fail when there's no connectivity, and many browsers don't fire onclose until the closing handshake either succeeds or fails. In any case, be aware that onclose will still fire if there is a heartbeat timeout in a potentially delayed manner.

      Returns void

onmatchdata: ((matchData: MatchData) => void)

Type declaration

    • (matchData: MatchData): void
    • Receive match data updates.

      Parameters

      Returns void

onmatchmakermatched: ((matchmakerMatched: MatchmakerMatched) => void)

Type declaration

onmatchmakerticket: ((matchmakerTicket: MatchmakerTicket) => void)

Type declaration

onmatchpresence: ((matchPresence: MatchPresenceEvent) => void)

Type declaration

onnotification: ((notification: Notification) => void)

Type declaration

    • (notification: Notification): void
    • Receive notifications from the socket.

      Parameters

      Returns void

onparty: ((party: Party) => void)

Type declaration

    • (party: Party): void
    • Receive party events.

      Parameters

      Returns void

onpartyclose: ((partyClose: PartyClose) => void)

Type declaration

    • (partyClose: PartyClose): void
    • Receive party close events.

      Parameters

      • partyClose: PartyClose

      Returns void

onpartydata: ((partyData: PartyData) => void)

Type declaration

    • (partyData: PartyData): void
    • Receive party data updates.

      Parameters

      Returns void

onpartyjoinrequest: ((partyJoinRequest: PartyJoinRequest) => void)

Type declaration

onpartyleader: ((partyLeader: PartyLeader) => void)

Type declaration

    • (partyLeader: PartyLeader): void
    • Receive announcements of a new party leader.

      Parameters

      Returns void

onpartymatchmakerticket: ((partyMatchmakerMatched: PartyMatchmakerTicket) => void)

Type declaration

onpartypresence: ((partyPresence: PartyPresenceEvent) => void)

Type declaration

onstatuspresence: ((statusPresence: StatusPresenceEvent) => void)

Type declaration

onstreamdata: ((streamData: StreamData) => void)

Type declaration

onstreampresence: ((streamPresence: StreamPresenceEvent) => void)

Type declaration

Methods

  • Accept a request to join.

    Parameters

    Returns Promise<void>

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

    Parameters

    • query: string
    • minCount: number
    • maxCount: number
    • Optional stringProperties: Record<string, string>
    • Optional numericProperties: Record<string, number>

    Returns Promise<MatchmakerTicket>

  • Begin matchmaking as a party.

    Parameters

    • party_id: string
    • query: string
    • min_count: number
    • max_count: number
    • Optional string_properties: Record<string, string>
    • Optional numericProperties: Record<string, number>

    Returns Promise<PartyMatchmakerTicket>

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

    Parameters

    • party_id: string

    Returns Promise<void>

  • Create a multiplayer match on the server.

    Parameters

    • Optional name: string

    Returns Promise<Match>

  • Create a party.

    Parameters

    • open: boolean
    • max_size: number

    Returns Promise<Party>

  • Disconnect from the server.

    Parameters

    • fireDisconnectEvent: boolean

    Returns void

  • Subscribe to one or more users for their status updates.

    Parameters

    • user_ids: string[]

    Returns Promise<Status>

  • Join a chat channel on the server.

    Parameters

    • target: string
    • type: number
    • persistence: boolean
    • hidden: boolean

    Returns Promise<Channel>

  • Join a multiplayer match.

    Parameters

    • Optional match_id: string
    • Optional token: string
    • Optional metadata: {}

      Returns Promise<Match>

    • Join a party.

      Parameters

      • party_id: string

      Returns Promise<void>

    • Leave a chat channel on the server.

      Parameters

      • channel_id: string

      Returns Promise<void>

    • Leave a multiplayer match on the server.

      Parameters

      • matchId: string

      Returns Promise<void>

    • Leave a party.

      Parameters

      • party_id: string

      Returns Promise<void>

    • Leave the matchmaker pool with the provided ticket.

      Parameters

      • ticket: string

      Returns Promise<void>

    • Cancel a party matchmaking process using a ticket.

      Parameters

      • party_id: string
      • ticket: string

      Returns Promise<void>

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

      Parameters

      Returns Promise<void>

    • Execute an RPC function to the server.

      Parameters

      • Optional id: string
      • Optional payload: string
      • Optional http_key: string

      Returns Promise<ApiRpc>

    • When no presences are supplied the new match state will be sent to all presences.

      Parameters

      • matchId: string
      • opCode: number
      • data: string | Uint8Array
      • Optional presence: Presence[]

      Returns Promise<void>

    • Send data to a party.

      Parameters

      • party_id: string
      • opcode: number
      • data: string | Uint8Array

      Returns Promise<void>

    • Unfollow one or more users from their status updates.

      Parameters

      • user_ids: string[]

      Returns Promise<void>

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

      Parameters

      • channel_id: string
      • message_id: string
      • content: any

      Returns Promise<ChannelMessageAck>

    • Update the status for the current user online.

      Parameters

      • Optional status: string

      Returns Promise<void>

    Generated using TypeDoc