Manages a websocket connection to a FudgeServer and multiple rtc-connections to other FudgeClients.
Processes messages from in the format FudgeNet.Message according to the controlling fields FudgeNet.ROUTE and FudgeNet.COMMAND.

Author

Falco Böhnke, HFU, 2019 | Jirka Dell'Oro-Friedl, HFU, 2021-2022

Hierarchy

  • EventTarget
    • FudgeClient

Constructors

Properties

clientsInfoFromServer: {
    [id: string]: {
        isHost?: boolean;
        name?: string;
    };
} = {}

Type declaration

  • [id: string]: {
        isHost?: boolean;
        name?: string;
    }
    • Optional isHost?: boolean
    • Optional name?: string
id: string
idHost: string
idRoom: string = "Lobby"
name: string
peers: {
    [id: string]: Rtc;
} = {}

Type declaration

  • [id: string]: Rtc
socket: WebSocket
urlServer: string

Methods

  • Sends out a disconnect message to all peers, disconnects from all peers and sends a CONNECT_HOST-command to the server, to establish RTC-peer-connections between this client and all others, making this the host

    Returns void

  • Tries to connect to another client with the given id via rtc

    Parameters

    • _idPeer: string

    Returns void

  • Tries to connect to the server at the given url and installs the appropriate listeners

    Parameters

    • _uri: string = "ws://localhost:8080"

    Returns void

  • Sends out a disconnect message to all peers, disconnects from all peers and sends a CREATE_MESH-command to the server, to establish RTC-peer-connections between all clients

    Returns void

  • Tries to disconnect the peer given with id

    Parameters

    • _idRemote: string

    Returns void

  • Disconnect all peers

    Parameters

    • Optional _ids: string[]

    Returns void

  • Tries to publish a human readable name for this client. Identification still solely by id

    Parameters

    • _name: string

    Returns void