Skip to main content

Module slack

Module slack 

Source
Expand description

Slack messaging bridge — Socket Mode WebSocket receive + Web API send.

Lifecycle:

  1. SlackBridge::init_global(config, http) — call once at startup.
  2. The Socket Mode loop (inbound) and the outbound send loop run in the background as two independent tokio tasks joined by socket::run_bridge — see that module’s doc comment for why they’re split rather than interleaved (mirrors telegram/poller.rs).
  3. SlackBridge::get() returns the singleton for HTTP handler use.
  4. bridge.send(msg) enqueues a message for the REST client.
  5. bridge.health() returns the current connection status.

Unlike Discord’s fixed Gateway URL, Slack’s Socket Mode WS URL is ephemeral and single-use — a fresh URL is fetched via apps.connections.open before every connection attempt (initial connect and every reconnect), inside the spawned background task. init_global itself does no network I/O and returns immediately, matching Discord’s and Telegram’s synchronous, non-blocking init.

Modules§

rest
Slack Web API REST client — apps.connections.open (Socket Mode URL fetch) + chat.postMessage for outbound delivery.
socket 🔒
Slack Socket Mode connection lifecycle: apps.connections.open, the hello/events_api/disconnect-warning state machine, per-event ACK, the make-before-break reconnect-on-warning dance, and the 5-minute dead-connection timer — plus the outbound chat.postMessage sender.
types
Slack Socket Mode + Web API wire types.

Structs§

SlackBridge
SlackConfig

Statics§

GLOBAL_BRIDGE 🔒