You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that the Locals are read-only within the Websocket, and I was wonder if there is a reason for that?
I'm looking to persist user context through-out the length of the connection and was hoping to use Locals.
Would something like the below change be feasible? (I can submit a PR if so)
Code Snippet (optional)
// Locals makes it possible to pass interface{} values under string keys scoped to the request// and therefore available to all following routes that match the request.func (conn*Conn) Locals(keystring, value...interface{}) interface{} {
iflen(value) ==0 {
returnconn.locals[key]
}
conn.locals[key] =value[0]
returnvalue[0]
}
Question Description
I notice that the
Locals
are read-only within the Websocket, and I was wonder if there is a reason for that?I'm looking to persist user context through-out the length of the connection and was hoping to use
Locals
.Would something like the below change be feasible? (I can submit a PR if so)
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: