Skip to content

Auto-host mode #8

@delucis

Description

@delucis

Using PeerJS’s 'unavailable-id' error type, it might be possible to automatically decide which client is the host.

  1. All clients would initially attempt to claim the host ID.

  2. If a client receives the 'unavailable-id' error, that indicates a peer has already taken the role of host and the client should attempt to connect to the existing host.

API could be P2P({ isHost: 'auto' }).

This has the advantage of the web app not needing to decide who hosts in advance. Just fire up the P2P transport and the first client to connect will host.

The disadvantage would likely be primarily for longer running games once #3 is implemented. With state persistence it would probably be desirable to have a static host. Some form of #4 could mitigate that: any client can host and all clients persist state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions