Skip to main content
Version: 3.6.0

Authentication

If your setup requires authentication, the SDK provides an authenticate method to obtain an access token using client credentials.

Usage​

async function authenticateClient() {
try {
const token = await client.authenticate();
console.log('Authentication successful. Token:', token);
} catch (error) {
console.error('Authentication failed:', error);
}
}

Note: Ensure that authenticationUrl, clientId, and clientSecret are correctly set in the configuration.

Establishing a WebSocket Connection​

After authentication (if required), you can establish a WebSocket connection using the obtained token:

async function connectWebSocket() {
const token = await client.authenticate();
client.openConnection(token);
}