Skip to main content

Relay

The startRelay function starts a relay server on the device and returns a client.

import { gpio } from "@devicescript/core"
import { startRelay } from "@devicescript/servers"

const relay = startRelay({
pin: gpio(2),
})

The service instance name is automatically set to the variable name. In this example, it is set to relay.

Options

pin

The pin hardware identifier on which to mount the relay.

options

Other configuration options are available in the options parameter.