Variable: connect

const connect: (options) => Promise<PlotClient>

Connects the current game to Plot.

Call this during game startup and wait for it before using Plot features. Concurrent calls share the same pending or completed connection. If an attempt fails, a later call can retry.

Parameters

options?

PlotConnectOptions = {}

Optional connection settings.

Returns

Promise<PlotClient>

A promise for the connected game client.

Throws

PlotConnectionError when the page is not running as a Plot game, its connection settings are invalid, or Plot cannot connect to it.

Example

import PlotSDK from '@plot.game/sdk'

const plot = await PlotSDK.connect()
console.log(plot.connected)