HoloPlayCore.Client
A class representing a client that communicates with HoloPlay Service.
Constructor
initCallbackfunction optional; a function that triggers when response is received.errCallbackfunction optional; a function that triggers when there is a connection error.closeCallbackfunction optional; a function that triggers when the socket is closed.debugboolean optional; default isfalse. If true, there will be logging messages in console.appIdstring optional; see InitMessage for more details.isGreedyboolean optional; see InitMessage for more details.oncloseBehaviorstring optional; see InitMessage for more details.
Returns information of the connected Looking Glass devices, in the format of device status response.
Example
const client = new HoloPlayCore.Client(
(msg) => {
console.log('Calibration values:', msg);
},
(err) => {
console.error('Error creating HoloPlay client:', err);
});Methods
.sendMessage(msg, timeoutSecs)
Send a Message object over the websocket to the HoloPlay Service.
msgMessage objecttimeoutSecsinteger optional, default is60seconds
Returns a Promise.
Example
let infoMsg = new HoloPlayCore.InfoMessage();
client.sendMessage(infoMsg)
.then(() => console.log('Response received'))
.catch((err) => console.log(err));.disconnect()
Manually disconnects from the web socket.
Example
client.disconnect();Last updated
Was this helpful?