-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
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
Upgrade context? #5
Comments
That's interesting. I can use something like fasthttp does with ctx.UserValue widely used by routers and other middlewares. Would you like me to add that? |
Thank you for the quick response. |
Ok. I will add that for now. I will try to do other workaround later on |
You can do the following: upgr := Upgrader{
Origin: uri,
Handler: func(conn *Conn) {
v := conn.UserValue("custom")
if v == nil {
t.Fatal("custom is nil")
}
conn.WriteString(v.(string))
},
}
s := fasthttp.Server{
Handler: func(ctx *fasthttp.RequestCtx) {
ctx.SetUserValue("custom", text)
upgr.Upgrade(ctx)
},
} All the values will be copied from the fasthttp's RequestCtx |
Good work!! |
Hi,
First of all, thank you for great repo.
In my case, I want to pass some data to the ws handler like this:
The text was updated successfully, but these errors were encountered: