Open kitsonk opened 3 years ago
The specific issue (oakserver/oak#370) should be solved by #11675.
Not according to the OP. It allegedly is just connection: upgrade
.
Still a bit of guesswork if it is upgradeable unless you try to upgrade.
The no upgrade available
error means something is wrong in our check for valid websocket request and are considering invalid requests as valid ws requests, as that error is coming from hyper in the upgradewebsocket op
I understand what it means. If you look at the linked issue, there is no obvious reason why it is "invalid" and the error message give you no clue to narrow it down.
Also, if the only way to find out if something is definitively upgrade is to try to upgrade it, seems like a design limitation, ergo the request for something like we have in std
.
What is the usecase of wanting to check if it is upgradeable without upgrading it?
Specifically in oak, there is isUpgradable
in a context (and is acceptable
std
). This gives better middleware handling when trying to determine how to handle a request, versus having to try to upgrade the connection and catch an error (which should be done anyway, but recovering from an error versus explicit logic to handle when the connection is not upgradeable, is desirable).
At the very least, we are taking away capabilities (integrated into other libraries) from what we offer in std
without a good justification of why we are dropping functionality, irrespective of the perceived use case.
I see, sounds good to me to have then
The Deno
std
library for web sockets had a functionacceptable()
which would determine if a current HTTP request was upgradeable to a web socket. WithDeno.upgradeWebSocket()
there is nothing you can do to determine the acceptability of aRequest
to be upgraded definitively.Currently a user of oak is encountering an issue (oakserver/oak#370) were the
std
libraryacceptable()
is returning true, but when the socket is attempted to be upgraded it is failing, saying no upgrade is available. (Let alone the error message not providing enough information as to the cause of the inability to upgrade, it is simply sayingno upgrade available
).