Skip to content

Commit

Permalink
gen: add connection to the stream context
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Aoqui <luizaoqui@loopholelabs.io>
  • Loading branch information
lgfa29 committed Nov 6, 2024
1 parent 9934b70 commit d85630b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/server.templ
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func NewServer({{ GetServerFields .services }}, tlsConfig *tls.Config, logger ty
}
})

s.server.StreamContext = func(ctx context.Context, stream *frisbee.Stream) context.Context {
return context.WithValue(ctx, ConnectionContextKey, stream.Conn())
}

{{ end -}}

s.server.ConnContext = func (ctx context.Context, conn *frisbee.Async) context.Context {
Expand Down

0 comments on commit d85630b

Please sign in to comment.