Connects to another p2p client.
The other client's ID.
Disconnects from all peers and the broker server.
Disconnects from all other p2p clients.
Disconnects from the broker server, leaving the connections intact.
Disconnects from another p2p client.
The other client's ID.
Get the ID of the peer that triggered onConnection.
A JavaScript-only function to get the raw P2P DataConnection. This can be useful for example when you want to use a binary protocol instead of GDevelop variables for high-performance networking.
Returns the own current peer ID.
Get the ID of the peer that triggered onDisconnect.
Get an event, and creates it if it doesn't exist.
Get some data associated to the last trigger of an event.
The event to get data from.
Get the id of peer that caused the last trigger of an event.
The event to get the sender from.
Get a variable associated to the last trigger of an event.
The event to get the variable from.
The variable where to store the variable content.
Returns the latest error message.
Returns true once PeerJS finished initialization.
Returns true once if a remote peer just initiated a connection.
Returns true once a peer disconnected.
Returns true once when there is an error.
Returns true when the event got triggered by another p2p client.
Is data loss allowed (accelerates event handling when true)?
Overrides the default peer ID. Must be called before connecting to a broker. Overriding the ID may have unwanted consequences. Do not use this feature unless you really know what you are doing.
The peer ID to use when connecting to a broker.
Send an event to one specific connected client.
The ID of the client to send the event to.
The event to trigger.
Send an event to all connected clients.
The event to trigger.
Send an event to one specific connected client.
The ID of the client to send the event to.
The event to trigger.
Additional variable to send with the event.
Send an event to all connected clients.
The event to trigger.
Additional variable to send with the event.
Connects to a custom broker server.
The host of the broker server.
The port of the broker server.
The path (part of the url after the host) to the broker server.
Optional password to connect to the broker server.
Use ssl?
Adds an ICE server candidate, and removes the default ones provided by PeerJs. Must be called before connecting to a broker.
The URL of the STUN/TURN server.
An optional username to send to the server.
An optional password to send to the server.
Use default broker server. This is not recommended for published games, this server should only be used for quick testing in development.
Generated using TypeDoc
Tools for p2p multiplayer.