feat(queue): fence queued message editing against concurrent sends (#3480)

Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
This commit is contained in:
Clément Fiere
2026-09-10 15:32:06 +02:00
committed by GitHub
parent 39864c036c
commit 00683ae43f
132 changed files with 22194 additions and 742 deletions
+15
View File
@@ -2,10 +2,25 @@
package websocket
import (
"context"
"encoding/json"
"time"
)
type connectionIDContextKey struct{}
// WithConnectionID binds an inbound message to its live WebSocket connection.
// The value is server supplied and cannot be forged through a message payload.
func WithConnectionID(ctx context.Context, id string) context.Context {
return context.WithValue(ctx, connectionIDContextKey{}, id)
}
// ConnectionID returns the server-assigned WebSocket connection identifier.
func ConnectionID(ctx context.Context) string {
id, _ := ctx.Value(connectionIDContextKey{}).(string)
return id
}
// MessageType represents the type of WebSocket message
type MessageType string