Options
All
  • Public
  • Public/Protected
  • All
Menu

A socket connection to Nakama server implemented with the DOM's WebSocket API.

Hierarchy

  • DefaultSocket

Implements

Index

Constructors

constructor

Properties

Readonly adapter

adapter: WebSocketAdapter = ...

Private Readonly cIds

cIds: {}

Type declaration

  • [key: string]: PromiseExecutor

Readonly host

host: string

Private nextCid

nextCid: number

Readonly port

port: string

Readonly useSSL

useSSL: boolean = false

verbose

verbose: boolean = false

Methods

acceptPartyMember

  • acceptPartyMember(party_id: string, presence: Presence): Promise<void>

addMatchmaker

  • addMatchmaker(query: string, min_count: number, max_count: number, string_properties?: Record<string, string>, numeric_properties?: Record<string, number>): Promise<MatchmakerTicket>
  • Parameters

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

    Returns Promise<MatchmakerTicket>

addMatchmakerParty

  • addMatchmakerParty(party_id: string, query: string, min_count: number, max_count: number, string_properties?: Record<string, string>, numeric_properties?: Record<string, number>): Promise<PartyMatchmakerTicket>

closeParty

  • closeParty(party_id: string): Promise<void>

connect

createMatch

  • createMatch(): Promise<Match>

createParty

  • createParty(open: boolean, max_size: number): Promise<Party>

disconnect

  • disconnect(fireDisconnectEvent?: boolean): void

followUsers

  • followUsers(userIds: string[]): Promise<Status>

generatecid

  • generatecid(): string

joinChat

  • joinChat(target: string, type: number, persistence: boolean, hidden: boolean): Promise<Channel>

joinMatch

  • joinMatch(match_id?: string, token?: string, metadata?: {}): Promise<Match>

joinParty

  • joinParty(party_id: string): Promise<void>

leaveChat

  • leaveChat(channel_id: string): Promise<void>

leaveMatch

  • leaveMatch(matchId: string): Promise<void>

leaveParty

  • leaveParty(party_id: string): Promise<void>

listPartyJoinRequests

onchannelmessage

  • onchannelmessage(channelMessage: ChannelMessage): void

onchannelpresence

ondisconnect

  • ondisconnect(evt: Event): void

onerror

  • onerror(evt: Event): void

onmatchdata

onmatchmakermatched

onmatchmakerticket

onmatchpresence

onnotification

onparty

  • onparty(party: Party): void

onpartyclose

  • onpartyclose(): void

onpartydata

onpartyjoinrequest

onpartyleader

onpartymatchmakerticket

onpartypresence

onstatuspresence

onstreamdata

onstreampresence

promotePartyMember

removeChatMessage

  • removeChatMessage(channel_id: string, message_id: string): Promise<ChannelMessageAck>

removeMatchmaker

  • removeMatchmaker(ticket: string): Promise<void>

removeMatchmakerParty

  • removeMatchmakerParty(party_id: string, ticket: string): Promise<void>

removePartyMember

  • removePartyMember(party_id: string, member: Presence): Promise<void>

rpc

  • rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>
  • Parameters

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

    Returns Promise<ApiRpc>

send

  • send(message: PartyCreate | PartyJoinRequestList | PartyClose | ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | ChannelMessageRemove | CreateMatch | JoinMatch | LeaveMatch | MatchDataSend | MatchmakerAdd | MatchmakerRemove | PartyAccept | PartyDataSend | PartyJoin | PartyLeave | PartyMatchmakerAdd | PartyMatchmakerRemove | PartyPromote | PartyRemove | Rpc | StatusFollow | StatusUnfollow | StatusUpdate): Promise<any>
  • Parameters

    • message: PartyCreate | PartyJoinRequestList | PartyClose | ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | ChannelMessageRemove | CreateMatch | JoinMatch | LeaveMatch | MatchDataSend | MatchmakerAdd | MatchmakerRemove | PartyAccept | PartyDataSend | PartyJoin | PartyLeave | PartyMatchmakerAdd | PartyMatchmakerRemove | PartyPromote | PartyRemove | Rpc | StatusFollow | StatusUnfollow | StatusUpdate

    Returns Promise<any>

sendMatchState

  • sendMatchState(matchId: string, opCode: number, data: any, presences?: Presence[]): Promise<void>

sendPartyData

  • sendPartyData(party_id: string, op_code: number, data: any): Promise<void>

unfollowUsers

  • unfollowUsers(user_ids: string[]): Promise<void>

updateChatMessage

  • updateChatMessage(channel_id: string, message_id: string, content: any): Promise<ChannelMessageAck>

updateStatus

  • updateStatus(status?: string): Promise<void>

writeChatMessage

Generated using TypeDoc