diff options
Diffstat (limited to 'internal/handler')
| -rw-r--r-- | internal/handler/websocket/handler.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/handler/websocket/handler.go b/internal/handler/websocket/handler.go index 8daa89f..35d0aea 100644 --- a/internal/handler/websocket/handler.go +++ b/internal/handler/websocket/handler.go | |||
| @@ -33,6 +33,7 @@ type MetricsRecorder interface { | |||
| 33 | DecrementSubscriptions() | 33 | DecrementSubscriptions() |
| 34 | SetActiveSubscriptions(count int) | 34 | SetActiveSubscriptions(count int) |
| 35 | RecordRequest(method, status string, duration float64) | 35 | RecordRequest(method, status string, duration float64) |
| 36 | RecordBlockedEvent(kind int32) | ||
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | type RateLimiter interface { | 39 | type RateLimiter interface { |
| @@ -302,6 +303,9 @@ func (h *Handler) handleEvent(ctx context.Context, conn *websocket.Conn, raw []j | |||
| 302 | // Reject non-core protocol kinds (spam, ephemeral, chat) | 303 | // Reject non-core protocol kinds (spam, ephemeral, chat) |
| 303 | if !isAllowedKind(pbEvent.Kind) { | 304 | if !isAllowedKind(pbEvent.Kind) { |
| 304 | status = "ok" | 305 | status = "ok" |
| 306 | if h.metrics != nil { | ||
| 307 | h.metrics.RecordBlockedEvent(pbEvent.Kind) | ||
| 308 | } | ||
| 305 | h.sendOK(ctx, conn, event.ID, true, "rejected: kind not supported") | 309 | h.sendOK(ctx, conn, event.ID, true, "rejected: kind not supported") |
| 306 | return nil | 310 | return nil |
| 307 | } | 311 | } |
