Not able to use Room model inside chatcontroller

const Ws = use(‘Ws’)
const Room = use(“App/Models/Room”)

class ChatController {
constructor ({ socket, request,auth }) {
this.socket = socket
this.request = request
this.auth = auth

// broadcastToAll(‘message’, message)
onMessage (message) {
const id =;
const topic = Ws.getChannel(this.socket.topic).topic(this.socket.topic);



await and yield are also not running inside the ws controller

Await works only in async functions.

If you want to run it you have to make some function async and use await in there

1 Like