We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgradeWebSocket
I think accepting using upgradeWebSocket like a stream is good. For example:
import { Hono } from 'hono' import { upgradeWebSocket } from '.....' const app = new Hono() app.get('/ws', c => { return upgradeWebSocket(c, { onOpen () { console.log('opened!') } }) })
Because user can write more flexible code such as creating custom response in WebSocket route.
The text was updated successfully, but these errors were encountered:
but why a right minded person will create custom response on this kind of thing
Sorry, something went wrong.
Hi @Lucifer359-IV, for example, you can do that
app.get('/ws', c => { if (!validToken(c.req.query('token'))) { return c.text('Unauthorized', 400) } return upgradeWebSocket(c, { onOpen () { console.log('opened!') } }) })
Also you can change the response with or without the upgrade header.
@nakasyou can't you do that token validation with a middleware?
Also have you checked the streaming helper section in the docs?
No branches or pull requests
What is the feature you are proposing?
I think accepting using
upgradeWebSocket
like a stream is good.For example:
Because user can write more flexible code such as creating custom response in WebSocket route.
The text was updated successfully, but these errors were encountered: