Repository navigation
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 |
Replies: 6 comments
|
https://unetworking.github.io/uWebSockets.js/generated/interfaces/httpresponse.html#writestatus You can do it but it's not obvious |
|
But I can't without reimplementing https://github.com/uNetworking/uWebSockets/blob/master/src/HttpResponse.h#L195 |
|
writeStatus can only be called once, so second time will be ignored. writeStatus, writeHeader, upgrade is the order you have to use |
|
Ah I see ... ok ... so I just have to "duplicate" the Thanks! |
|
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 |
|
Yes. |
Ah I see ... ok ... so I just have to "duplicate" the
writeStatus("101 Switching Protocols")line ... okay ... that's ... acceptable ;-)Thanks!