diff --git a/doc/docs.md b/doc/docs.md index c0822f3..4da81d7 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -97,6 +97,7 @@ - [ServerMessage.HlsPlayable](#fishjam-ServerMessage-HlsPlayable) - [ServerMessage.HlsUploadCrashed](#fishjam-ServerMessage-HlsUploadCrashed) - [ServerMessage.HlsUploaded](#fishjam-ServerMessage-HlsUploaded) + - [ServerMessage.NotificationBatch](#fishjam-ServerMessage-NotificationBatch) - [ServerMessage.PeerAdded](#fishjam-ServerMessage-PeerAdded) - [ServerMessage.PeerConnected](#fishjam-ServerMessage-PeerConnected) - [ServerMessage.PeerCrashed](#fishjam-ServerMessage-PeerCrashed) @@ -1363,6 +1364,7 @@ Defines any type of message passed between FJ and server peer | viewer_disconnected | [ServerMessage.ViewerDisconnected](#fishjam-ServerMessage-ViewerDisconnected) | | | | streamer_connected | [ServerMessage.StreamerConnected](#fishjam-ServerMessage-StreamerConnected) | | | | streamer_disconnected | [ServerMessage.StreamerDisconnected](#fishjam-ServerMessage-StreamerDisconnected) | | | +| notification_batch | [ServerMessage.NotificationBatch](#fishjam-ServerMessage-NotificationBatch) | | Batch | | stream_connected | [ServerMessage.StreamConnected](#fishjam-ServerMessage-StreamConnected) | | **Deprecated.** | | stream_disconnected | [ServerMessage.StreamDisconnected](#fishjam-ServerMessage-StreamDisconnected) | | **Deprecated.** | | hls_playable | [ServerMessage.HlsPlayable](#fishjam-ServerMessage-HlsPlayable) | | **Deprecated.** | @@ -1498,6 +1500,31 @@ Notification sent when the HLS recording is successfully uploaded to AWS S3 + + +### ServerMessage.NotificationBatch +Carries multiple notifications in a single wire frame. + +Constraints (documented, not schema-enforced): + - Each element's `content` MUST be a notification variant — never + Authenticated, AuthRequest, SubscribeRequest, or SubscribeResponse. + - NotificationBatch MUST NOT be nested inside another NotificationBatch. + The schema technically permits this, but senders must not emit + recursive batches and receivers may treat them as a protocol violation. + - Notifications are delivered in array order; consumers must process + them in order. + - Sent only for webhooks, for peers that . + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| notifications | [ServerMessage](#fishjam-ServerMessage) | repeated | | + + + + + + ### ServerMessage.PeerAdded diff --git a/fishjam/server_notifications.proto b/fishjam/server_notifications.proto index 79d81cc..80a7948 100644 --- a/fishjam/server_notifications.proto +++ b/fishjam/server_notifications.proto @@ -233,6 +233,21 @@ message ServerMessage { string streamer_id = 2; } + // Carries multiple notifications in a single wire frame. + // + // Constraints (documented, not schema-enforced): + // - Each element's `content` MUST be a notification variant — never + // Authenticated, AuthRequest, SubscribeRequest, or SubscribeResponse. + // - NotificationBatch MUST NOT be nested inside another NotificationBatch. + // The schema technically permits this, but senders must not emit + // recursive batches and receivers may treat them as a protocol violation. + // - Notifications are delivered in array order; consumers must process + // them in order. + // - Sent only for webhooks, for peers that . + message NotificationBatch { + repeated ServerMessage notifications = 1; + } + reserved 12; oneof content { @@ -273,6 +288,9 @@ message ServerMessage { StreamerConnected streamer_connected = 26; StreamerDisconnected streamer_disconnected = 27; + // Batch + NotificationBatch notification_batch = 33; + // Deprecated StreamConnected stream_connected = 22 [deprecated = true]; diff --git a/fishjam_protos/lib/fishjam/server_notifications.pb.ex b/fishjam_protos/lib/fishjam/server_notifications.pb.ex index d0ad43b..60f3d9e 100644 --- a/fishjam_protos/lib/fishjam/server_notifications.pb.ex +++ b/fishjam_protos/lib/fishjam/server_notifications.pb.ex @@ -443,6 +443,17 @@ defmodule Fishjam.ServerMessage.StreamerDisconnected do field :streamer_id, 2, type: :string, json_name: "streamerId" end +defmodule Fishjam.ServerMessage.NotificationBatch do + @moduledoc false + + use Protobuf, + full_name: "fishjam.ServerMessage.NotificationBatch", + protoc_gen_elixir_version: "0.16.0", + syntax: :proto3 + + field :notifications, 1, repeated: true, type: Fishjam.ServerMessage +end + defmodule Fishjam.ServerMessage do @moduledoc false @@ -572,6 +583,11 @@ defmodule Fishjam.ServerMessage do json_name: "streamerDisconnected", oneof: 0 + field :notification_batch, 33, + type: Fishjam.ServerMessage.NotificationBatch, + json_name: "notificationBatch", + oneof: 0 + field :stream_connected, 22, type: Fishjam.ServerMessage.StreamConnected, json_name: "streamConnected", diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..b61bc7d --- /dev/null +++ b/prepare.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +find fishjam -name "*.proto" | sort | xargs docker run --rm -v $PWD/doc:/out -v $PWD:/protos pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md + +buf format -w +buf lint + +(cd ./fishjam_protos; ./compile_proto.sh)