-
Hi folks! I'm curious if anyone have setup socket.io-stream (https://www.npmjs.com/package/socket.io-stream) with TsED's SocketIO implementation before? |
Beta Was this translation helpful? Give feedback.
Answered by
Romakita
Feb 1, 2023
Replies: 1 comment
-
Hello @LefanTan @SocketService("/room")
@SocketUseBefore(AuthSocketMiddleware)
@SocketUseAfter(ErrorHandlerSocketMiddleware)
export class RoomWS {
// tslint:disable-next-line: no-unused-variable
constructor(@IO private io: Server) {}
$onConnection(socket: IOSocket, nsp: Namespace) {
ss(socket).on('profile-image', this.handleStream.bind(this));
}
handleStream(stream, data) {
var filename = path.basename(data.name);
stream.pipe(fs.createWriteStream(filename));
}
} See you |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LefanTan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @LefanTan
Actually, you can use that manually, by using the $onConnection hook:
See you
Romain