Live: streamId in path for ws push endpoint (#33786)

This commit is contained in:
Alexander Emelin
2021-05-06 12:28:14 -07:00
committed by GitHub
parent f929b29b0b
commit bfd5d3b16a
3 changed files with 21 additions and 9 deletions
+15
View File
@@ -38,3 +38,18 @@ func GetContextValues(ctx context.Context) (url.Values, bool) {
}
return nil, false
}
type streamIDContextKey struct{}
func SetContextStreamID(ctx context.Context, streamID string) context.Context {
ctx = context.WithValue(ctx, streamIDContextKey{}, streamID)
return ctx
}
func GetContextStreamID(ctx context.Context) (string, bool) {
if val := ctx.Value(streamIDContextKey{}); val != nil {
values, ok := val.(string)
return values, ok
}
return "", false
}