HoloPlayCore.Client
A class representing a client that communicates with HoloPlay Service.

Constructor

  • initCallback function optional; a function that triggers when response is received.
  • errCallback function optional; a function that triggers when there is a connection error.
  • closeCallback function optional; a function that triggers when the socket is closed.
  • debug boolean optional; default is false. If true, there will be logging messages in console.
  • appId string optional; see InitMessage for more details.
  • isGreedy boolean optional; see InitMessage for more details.
  • oncloseBehavior string optional; see InitMessage for more details.
Returns information of the connected Looking Glass devices, in the format of device status response.
Example
1
const client = new HoloPlayCore.Client(
2
(msg) => {
3
console.log('Calibration values:', msg);
4
},
5
(err) => {
6
console.error('Error creating HoloPlay client:', err);
7
});
Copied!

Methods

.sendMessage(msg, timeoutSecs)

Send a Message object over the websocket to the HoloPlay Service.
  • msg Message object
  • timeoutSecs integer optional, default is 60 seconds
Returns a Promise.
Example
1
let infoMsg = new HoloPlayCore.InfoMessage();
2
client.sendMessage(infoMsg)
3
.then(() => console.log('Response received'))
4
.catch((err) => console.log(err));
Copied!

.disconnect()

Manually disconnects from the web socket.
Example
1
client.disconnect();
Copied!