Status API uses Socket.IO

I am new to I keep getting the connection error when try to establish the websocket connection, can anyone helps with it?

const io = require('');

// Replace with your actual access token and status channel ID
const accessToken = 'Your_Access_Token_Here'; // replace with my own access token
const statusChannel = 'Your_Status_Channel_ID_Here'; // replace with the channel i got from restfult api

// Establish a WebSocket connection
const socket = io.connect('', {
    transports: ['websocket'],
    query: {
        'token': accessToken

// Listen for the connection event
socket.on('connect', () => {
    console.log('Successfully connected to the server.');

    // Subscribe to the status channel
    socket.emit('subscribe', {
        "channel": statusChannel

    console.log(`Subscribed to status channel: ${statusChannel}`);

// Handle incoming messages on the subscribed channel
socket.on(statusChannel, (message) => {
    console.log('Received message:', message);

// Listen for connection errors
socket.on('connect_error', (err) => {
    console.error('Connection error:', err.message);

This topic was automatically closed after 15 days. New replies are no longer allowed.