Subscription types: Map subscriptions and Shared Poll subscriptions#1125
Draft
Subscription types: Map subscriptions and Shared Poll subscriptions#1125
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends Centrifugo with support for the two new subscription types introduced in the centrifuge library centrifugal/centrifuge#565 — Map subscriptions and Shared Poll subscriptions — and adds a PostgreSQL MapBroker as a first-class engine option.
Map subscriptions
Integrates centrifuge's map subscription model into Centrifugo's configuration, proxy, and API layers.
subscription_type— each namespace declares its type:stream(default),map,map_clients,map_users, orshared_poll. Only matching subscription types are allowed per namespace.mapconfig block on namespace — controls mode (ephemeral/durable/persistent),key_ttl,ordered,stream_size,stream_ttl,external_state, publish/remove permissions, and proxy settings.map_clients_presence_channel_prefixandmap_users_presence_channel_prefixon stream namespaces allow tracking connection/user presence via MapBroker in a derived channel.MapPublish,MapRemove,MapReadState,MapReadStream,MapStats,MapClear(HTTP + gRPC).MapPublish,MapRemoveproxy types (HTTP + gRPC) for delegating map writes to the application backend.Shared Poll subscriptions
shared_pollconfig block on namespace —proxy_name,refresh_interval,refresh_batch_size,max_keys_per_connection,mode(versionless/versioned),publish_enabled(fast-track), and tuning options.SharedPollRefreshproxy type (HTTP + gRPC) that Centrifugo calls on each poll cycle with the aggregated key set. The backend returns current data per key.SharedPollPublishAPI — server API endpoint for fast-track publication to shared poll channels.internal/pubsubabstraction (Redis or NATS) used for shared poll cross-node notifications.PostgreSQL MapBroker
postgresoption formap_broker.typethat implements the fullMapBrokerinterface backed by PostgreSQL.LISTEN/NOTIFYfor low-latency wakeup.EnsureSchema()creates tables, indexes, and functions on startup. Supports forward migrations via integer versioning. Can be disabled withskip_schema_init.binary_dataflag switches between JSONB (queryable) and BYTEA (binary/protobuf payloads) column types.