Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/pita_api/mod.ts>Redpitaya#close

API for Pita projects, simpliest way to develop secure and powerful webapps for redpitaya.
Latest
method Redpitaya.prototype.close
import { Redpitaya } from "https://deno.land/x/pita_api@0.9.1/mod.ts";

Close the Redpitaya connection and triggers disconnect event.

Examples

Example 1

redpitaya.addEventListener('disconnect', handleDisconnect)
await redpitaya.pin.digital.led0.write(true) //ok
await redpitaya.close()
//handleDisconnect is called
await redpitaya.pin.digital.led0.write(true) //error

Parameters

optional
cause: string
  • The cause parameter is an optional string that describes the reason for closing the Redpitaya. If it is provided, it will be used as the detail for the CustomEvent that is dispatched to the disconnect listeners. If it is not provided, a default detail message will be used.

close() abort all pending messages, no finished state is lost.