Skip to content

feat: add support for socket.io ack #6

@xujif

Description

@xujif

please add socket.io ack support
like

    @OnMessage('some-message')
    @ReturnAck()
    action ( @ConnectedSocket() socket: SocketIO.Socket, @MessageBody() msg: any) {
        return "aa" 
    }
    @OnMessage('some-message-error')
    @ReturnAck()
    action2 ( @ConnectedSocket() socket: SocketIO.Socket, @MessageBody() msg: any) {
        throw new Error('xxx')
    }
// the logic is like next code:
socket.on('some-message',async (body:any,callback:(err: Error | null, ret?: any) => void){
   try{
       const ret = await action(body)
       callback(null,ret)
   }
   catch(e){
       callback(e)
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions