Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

How to close socket connection via middleware? #77

Description

@phambinh217

Dear,
I do the example follow: https://adonisjs.com/docs/4.1/websocket-server#_creating_middleware, and I modify some code like bellow

'use strict'

class CustomMiddleware {
  // for HTTP
  async handle (ctx, next) {
  }

  // for WebSocket
  async wsHandle (ctx, next) {
    ctx.socket.close() // I wan to close socket connection before it go to my ChatController
  }
}

module.exports = CustomMiddleware

But it not woking, socket never close. Is it bugs or what am I doing wrong?

I using adonisjs 4.1. my node version is 10.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions