Skip to content
Discussion options

You must be logged in to vote

对的,监听就好,其实就是 connection 时的 ctx 呀。

    @WSController()
    class WebSocketController {
      @Inject()
      ctx;

      @OnWSConnection()
      async connection() {
        this.ctx.on('pong', () => {
          console.log('got pong');
        });
      }
    }

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@flyingcrp
Comment options

@czy88840616
Comment options

@flyingcrp
Comment options

@czy88840616
Comment options

Answer selected by flyingcrp
@flyingcrp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type: question / discussion This issue or pull request need be discussion
2 participants