The onClose method of websocket worked as a controller does not issue a this.socket.broadcast ('desco', 'something')

server

 onClose () {
    
    this.socket.broadcast('desco',this.socket.user);
    this.DeconnectUserActiveChat(this.socket.user.user_id);
  }

client

chat.on('desco',(id) => {
            console.log(id);
           this function never triggers
        });
1 Like

Hi @virk

Iā€™m having the same issue.

  async onClose(){
    
    //this is never received.
    this.socket.broadcast('message',{
      type:'connection',
      connected:false,
      slug:this.auth.user.slug
    })

   //record gets deleted.
    await ActiveSocket.query()
    .where('socket_id',this.socket.id)
    .delete()
    
  }