-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
Description
You have been so helpful in the past, so here I am.
I have a route that serve HTTP and websocket connections. It works great. I would like to use the build-in validator to validate the object received no matter if it's through http or websocket.
fastify.route({
method: 'GET',
url: '/v1/testhybrid',
handler: (request, reply) => {
myfunction("http", request, reply)
},
wsHandler: (conn, request) => {
conn.setEncoding('utf8')
// **message need validation**
conn.socket.on('message', async message => {
myfunction("ws", conn, request, message)
})
}})
I never really had to use ws before and I just started using schema validation in fastify. Tips are welcome.