在SailsJS中,每个套接字响应都包含JWR头。我如何在每个套接字响应中注入自定义标头?
答案 0 :(得分:0)
router:route
事件可以解决这个问题:
sails.on('router:route', (route) => {
var { req: request, res: response } = route;
// Send `Lifted-At` header to client
if (request.isSocket) {
response.set('Lifted-At', sails.config.liftedAt.toUTCString());
}
});