In websocket middleware pass data to contorller

Hi ,I’m making a websocket middleware , I want to send data from middleware to controller.
Can someone help me?
Thanks.

This is my websocket middleware:

  async wsHandle({ request, response }, next) {
             request.user_id='test';
             next();
  }

This is my websocket controller:

The result is undefined

class ChatController {

  constructor({ socket, request }) {
    this.socket = socket;
    this.topic = socket.topic;
    this.request = request;
    console.log(request.user_id);
  }
}
1 Like

Yup, that was a bug and fixed in @adonisjs/websocket/1.0.12. Please upgrade.

3 Likes

Thank you for the prompt reply.:+1:

1 Like