furhat-gui
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

furhat-gui

Generated with nod NPM version Build Status Coverage Status

Client library for connecting to a Furhat skill from a skill GUI

Install

$ npm install --save furhat-gui

Usage

import FurhatGUI, { Furhat } from 'furhat-gui'

let furhat: Furhat = null

function setupSubscriptions () {
    furhat.subscribe('com.myapp.MyCustomEvent', (event) => {
        console.log('received event: ', event.event_name)
    })
}

FurhatGUI()
    .then(connection => {
        furhat = connection
        furhat.onConnectionError((_connection: WebSocket, ev: globalThis.Event) => {
            console.error("Error occured while connecting to Furhat skill")
        })
        furhat.onConnectionClose(() => {
            console.warn("Connection with Furhat skill has been closed")
        })
        setupSubscriptions()
    })
    .catch(console.error)

// Later somewhere in the code (after awaiting for the connection promise)
furhat.send({
    event_name: 'MyEvent',
    param1: 'MyParam1'
})

API

Table of Contents

FurhatGUI

FurhatGUI Function which sets up a connection to the furhat skill and gives the furhat object to send and recieve events to the skill.

Returns any Promise that will return the promise with a Furhat obkect

Readme

Keywords

Package Sidebar

Install

npm i furhat-gui

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

16.2 kB

Total Files

5

Last publish

Collaborators

  • limalima
  • mathieu_furhat
  • furhatrobotics
  • morgan-furhat
  • subbualagappan
  • quintenfurhat
  • kasparfh
  • johan_furhat