Allow custom headers in "upgrade" response #1075
-
There was no possibility so far, to set custom headers (e.g. for diagnostic purposes) in the HTTP "upgrade" response. With the cool new "upgrade" handler, it seems to be much easier now, to integrate such an interface (currently it's still impossible without patching, right?). Maybe as a parameter/callback of |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
https://unetworking.github.io/uWebSockets.js/generated/interfaces/httpresponse.html#writestatus You can do it but it's not obvious |
Beta Was this translation helpful? Give feedback.
-
But I can't without reimplementing https://github.com/uNetworking/uWebSockets/blob/master/src/HttpResponse.h#L195 |
Beta Was this translation helpful? Give feedback.
-
writeStatus can only be called once, so second time will be ignored. writeStatus, writeHeader, upgrade is the order you have to use |
Beta Was this translation helpful? Give feedback.
-
Ah I see ... ok ... so I just have to "duplicate" the Thanks! |
Beta Was this translation helpful? Give feedback.
-
Yes that is not very obvious but it works for now. Upgrade could take a callback like cork does, in which you writeHeader but that's for another time |
Beta Was this translation helpful? Give feedback.
Ah I see ... ok ... so I just have to "duplicate" the
writeStatus("101 Switching Protocols")
line ... okay ... that's ... acceptable ;-)Thanks!