Client library for connecting to and operating FurhatOS (read more at: www.furhatrobotics.com)
Install using:
npm install furhat-core
Import (ES6 import syntax) using:
import Furhat from 'furhat-core'
Initialize the connection:
let furhat = new Furhat('localhost', 80, 'api')
furhat.init()
.then(({error, message}) => {
if(error) {
console.log('Something went wrong:', message)
return
}
furhat.say('I am connected!')
})
.catch(({error, message}) => console.log('Something went wrong:', message))
// or you can use the async/await syntax
try {
const {error, message} = await furhat.init()
if(error) {
console.log('Something went wrong:', message)
return
}
furhat.say('I am connected!')
} catch({error, message}) {
console.log('Something went wrong:', message)
}
Furhat main class. Maintains the websocket connection to furhatOS and has methods to send events, subscribe to events and helper methods such as say, gesture, etc.
Parameters
domainIP Address for furhatOS - localhost if SDK.portport for RealTimeAPI module of furhatOS.routeroute for RealTimeAPI module of furhatOS.
Initializes the connection and return a promise. Await for the promise to resolve before using the object
Sends an event to furhatOS
Parameters
eventObject containing the event. Mandtory to have event_name parameter in the object
Subscribes to the given event and triggers the supplied callback on event
Parameters
eventNameName of the event to subscribecallbackFunction which needs to be triggered when the given event is recieveddontSend[Optional][false by default] Boolean which determines wether to send the subscribe event or not. use it to set callbacks for event that are already subscribed to, for instance with group subscriptions
Subscribes to the given event group
Parameters
groupNumberNumber(Assigned ENUM) of the group that needs to be subscribed to
Says a given text
Parameters
textText which needs to be said by Furhat
Stimulates the speech of a user in the interaction space
Parameters
textText which needs to be said by the user
Stimulates SenseSpeechStart event. Can be used to stimulate user speech via typing
Performs the given gesture
Parameters
nameName of the gesture that needs to be performed