Cantabile
Represents a connection to Cantabile.
Table of Contents
Constructor
Cantabile
-
host
Parameters:
-
[host]
String optionalThe host to connect to. This can be either
or http:// or ws:// When running in a browser, the defaults to ${window.location.host}
. In other environments it defaults tolocalhost:35007
.
Methods
connect
()
Initiate connection and retry if fails
disconnect
()
Disconnect and stop retries
request
-
obj
Stringify an object as a JSON message, send it to the server and returns a promise which will resolve to the result.
Parameters:
-
obj
ObjectThe object to send
Returns:
send
-
obj
Stringify an object as a JSON message and send it to the server
Parameters:
-
obj
ObjectThe object to send
untilConnected
()
Promise
Returns a promise that will be resolved when connected
Returns:
Example:
let C = new CantabileApi();
await C.untilConnected();
Properties
host
String
The current host
host
String
The base socket url
host
String
The base host url
onscreenKeyboard
OnscreenKeyboard
Provides access to controllers managed by Cantabile's onscreen keyboard device
state
String
The current connection state, either "connecting", "connected" or "disconnected"
Events
connected
Fired when entering the connected state
connecting
Fired when entering the connecting state
disconnected
Fired when entering the disconnected state
stateChanged
Fired when the state property value changes
Event Payload:
-
state
StringThe new connection state ("connecting", "connected" or "disconnected")