Websocket connection is not in open state

trying to send an emit and I’m with this message.
adonis:websocket connection is not in open state, current state 0
help please?

Are you trying to send from server or from client?
Are you sure your connection is initialized?

Can you share some code?

code client:
const ws = adonis.Ws(“ws://127.0.0.1:3333”).connect();
let isConnected = false

ws.on(‘open’, () => {
isConnected = true
})

ws.on(‘close’, () => {
isConnected = false
})
const bot = ws.subscribe(‘bot:*’)

bot.on(‘bot’, (message) => {

let e = document.getElementById("btc").innerText= message

console.log(message)

})
code http controller:
let topic = Ws.getChannel(‘bot:*’).topic(‘bot:balance’)

    if(topic){
      topic.broadcastToAll('bot:*',balance)
    }