OTP ERLANG Wiregrid Plainwire · Manual 1.0

Elixir

Elixir API

Wiregrid is the stable façade. Application code should call it, or Wiregrid.Chat, rather than ETS tables or internal process names. Results that can fail are tagged tuples. Session ids, resume tokens, prepared handles, dispatch plans, and cursors are opaque.

Discovery

Wiregrid.version()
Wiregrid.protocol_version()          # 1
Wiregrid.foreign_protocol_version()  # 1
Wiregrid.c_abi_major()               # 1
{:ok, caps} = Wiregrid.capabilities(:chat)
Wiregrid.describe(:chat)
Wiregrid.deployment_report(:chat)
Wiregrid.limits(:chat)

version/0 reads the application vsn and falls back to "1.0.0". capabilities/1 returns the feature list from Wiregrid.Info plus flags for cluster, webhooks, external storage, external cache, telemetry events, and isolated adapters. describe/1 adds public limits, health, and bounded statistics. Query helpers (session/2, topic_info/3, room_info/3, user_info/3, session_state/3, and the count functions) omit owner pids, monitors, resume hashes, adapter secrets, and table identifiers. List results stop at max_query_results (10,000) unless the caller passes a smaller limit.

Lifecycle and routing

Lifecycle: start_instance/2, instance_child_spec/2, stop_instance/1, connect/4, connect_resumable/4, resume_session/5, the actor variants, disconnect/3, disconnect_user/3, set_session_metadata/3.

Subscriptions: subscribe/4, unsubscribe/3, the _many forms, sync_subscriptions/4, sync_topology/4.

Publish: prepare/2, publish/4, publish_prepared/4, publish_batch/4, publish_topics/4, publish_topics_prepared/4, publish_room/4, publish_room_prepared/4, publish_rooms/4, publish_rooms_prepared/4, send_user/4, send_user_prepared/4, send_users/4, send_users_prepared/4, send_session/4, send_session_prepared/4, send_sessions/4, send_sessions_prepared/4, dispatch/4, dispatch_prepared/4, compile_dispatch/2, dispatch_plan/4, dispatch_plan_prepared/4.

Delivery, presence, storage, ops

Delivery: ack/2, ack/3, ack_many/3, pending/2, consume_delivery/3, consume_many_deliveries/3, consume_ordered_deliveries/3, consume_projection/5, request_session/5, reply/5, request_context/1, replay_session/4, decode_payload/2.

Presence and rooms: set_presence/4, set_status/3, presence/2, watch and unwatch (single and many), sync_presence_watches/4, join_room/4, leave_room/3, join_rooms/4, leave_rooms/3, sync_rooms/4, resume_room/4, room_members/3, room_metadata/2, set_room_metadata/5, set_room_ttl/4, activity/6, activities/4, typing/4, receipt/4, get_receipt/3, signal/6.

Storage and cache: storage_bootstrap/1, storage_health/1, append_event/5, get_event/3, page_events/4, read_history/5, delete_event/3, prune_events/4, cache_get/2, cache_put/4, cache_delete/2, cache_incr/4, cache_health/1.

Operations: health/1, readiness/1, readiness_report/1, liveness/1, stats/1, pressure/1, prometheus_metrics/1, drain/1, undrain/1, await_idle/2, graceful_shutdown/2, rate_limit/5, rate_limit/6, webhook/4, issue_transport_token/3, verify_transport_token/3.

Counts

Wiregrid.topic_subscriber_count(:chat, {:channel, "general"})
Wiregrid.room_member_count(:chat, "lobby")
Wiregrid.presence_watcher_count(:chat, "alice")
Wiregrid.user_session_count(:chat, "alice")

Hot consumers can use Wiregrid.Consumer.Worker with collect_wait_ms from 0 to 50. The worker collects up to its configured burst from its own mailbox and still acknowledges through Wiregrid.ack. It does not become an unbounded queue in front of the runtime.

Wiregrid 1.0 · Plainwire · github.com/Plainwire-development/Wiregrid