Not able to fetch Index Market data with websocket

I am able to connect with socket successfully but after connection I am getting this error in the logs

{"level":"error","datetime":"2025-05-01T05:15:23.168Z","message":"wrong onwhat passed","data":{"onwhat":"message"},"functionName":"on"}

My code:

    fyersSocket.on("message",onmsg)
    fyersSocket.on("connect",onconnect)
    fyersSocket.on("error",onerror)
    fyersSocket.on("close",onclose)
    fyersSocket.connect();

Output:

incorrect value passed message

message_internal { code: 1605, message: 'Successfully subscribed', s: 'ok' }

I digged into the the Fyers SDK and found that there is no “message” variable,

This is the Fyers SDK code: fyersSocket.js

on(onwhat, callback) {
        const funcname = "on"
        const logger = this.Logger
        try {
            if (onwhat === 'error') {
                this.onErrorCallback = callback;
            }
            else if (onwhat === 'general') {
                this.onMessageCallback = callback;
            }
            else if (onwhat === 'connect') {
                this.onOpenCallback = callback;
            }
            else if (onwhat === 'close') {
                const socketonclose = function (event){
                    callback(event)
                    if(!this.isUserClosed&&(reconnectiontries<this.maxreconnectiontries)){
                        this._autoreconnect()
                    }
                }
                this.onCloseCallback = socketonclose;
            }
            else if (onwhat === 'orders') {
                this.orderscallback = callback;
            }
            else if (onwhat === 'trades') {
                this.tradescallback = callback;
            }
            else if (onwhat === 'positions') {
                this.positionscallback = callback;
            }
            else {
                console.log("incorrect value passed", onwhat)
                logger.error("wrong onwhat passed", { "onwhat": onwhat }, funcname)
            }
        }

So this was the reason for that error, So please correct the Documentation or this code.

Secondly, If I use “general” instead of “message”, then the websocket hangs up.. does not connect, nothings happens

fyersSocket.on("general",onmsg)
    fyersSocket.on("connect",onconnect)
    fyersSocket.on("error",onerror)
    fyersSocket.on("close",onclose)
    fyersSocket.connect();

Output:

Nothing happens.

log:

{"level":"debug","datetime":"2025-05-01T05:19:17.840Z","message":"trying to subscribe to","data":{"towhat":["NSE:NIFTY50-INDEX"]},"functionName":"subscribe"}

Nothing after this.

Please tell, what I am doing wrong, or it is the issue of fyers

Hey @110233144350463595858 ,

Could you please DM your code snippet to check this further as i am facing no issue when checked locally. Also , please let us know the version of node youa re using .