IO Authentication

Each subscriber MUST connect to his namespace. A namespace is a path specifying which channel communication to use with Hades.

Subscribers

As mentioned in the API section, subscriber and subscriber_id have a major role. Some type are:

  • machine
  • client

Connection

let token = `<provided token>`
let organization = 'demo'
let subscriber = 'machine'
const socket = require('socket.io-client')(`https://${organization}.syncode.cloud/${subscriber}`, {
extraHeaders: { token },
})

Connection callbacks

// called on connection established
socket.on('connect', console.log)
// called on disconnection
socket.on('disconnect', console.log)
// called on connection error
socket.on('error', console.error)