pub struct RealSlackTransport { /* private fields */ }Expand description
Production SlackTransport — UNCONDITIONAL (no cfg gate, MC-11). Drives:
- Outbound
chat.postMessageviareqwest, fetching the bot token (xoxb-) from the OS keychain by its reference key at use-time (MC-9 — the token is never read out ofmessaging.json). - Inbound Socket Mode: opens a WebSocket via
apps.connections.open(using the app-level tokenxapp-, also keychain-fetched), reads frames, ACKs eachevents_api/interactiveenvelope within the ~3s window, and maps the two recognized shapes toSlackInboundEvent. The bot’s own echo is suppressed (subtype == "bot_message"/bot_idpresent).
The reconnect loop (resilient backoff, apps.connections.open per
connection, disconnect/warning handling) follows the Socket Mode
reference. next_event pulls from an internal channel the background
connection task feeds.
Implementations§
Source§impl RealSlackTransport
impl RealSlackTransport
Sourcepub fn new(
bot_token_key: impl Into<String>,
app_token_key: impl Into<String>,
) -> RealSlackTransport
pub fn new( bot_token_key: impl Into<String>, app_token_key: impl Into<String>, ) -> RealSlackTransport
Build the production transport. bot_token_key/app_token_key are the
keychain REFERENCE keys (from SlackTokenRefs) — the bearer values
live only in the OS keychain (MC-9).
Sourcepub fn spawn_socket_loop(self: Arc<RealSlackTransport>, cancel: Receiver<bool>)
pub fn spawn_socket_loop(self: Arc<RealSlackTransport>, cancel: Receiver<bool>)
Spawn the background Socket Mode reconnect loop. Each connection reads
frames, ACKs, maps the two recognized shapes, and forwards them to
inbound_tx. Runs until cancel flips. Per the reference: resilient
backoff, one apps.connections.open per connection, disconnect/error
→ reconnect.
Trait Implementations§
Source§impl SlackTransport for RealSlackTransport
impl SlackTransport for RealSlackTransport
Source§fn post_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 str,
text: &'life2 str,
approval_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
RealSlackTransport: 'async_trait,
fn post_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 str,
text: &'life2 str,
approval_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
RealSlackTransport: 'async_trait,
Post a Block Kit approval message carrying Approve/Deny buttons whose
value is the approval_id. text is the human-readable summary (also
carries the shared fan-out code for MC-8 equality). Returns the posted
message ts on success.Source§fn next_event<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<SlackInboundEvent>> + Send + 'async_trait>>where
'life0: 'async_trait,
RealSlackTransport: 'async_trait,
fn next_event<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<SlackInboundEvent>> + Send + 'async_trait>>where
'life0: 'async_trait,
RealSlackTransport: 'async_trait,
Block until the next inbound Slack event (button click or DM), or
None when the source is exhausted / cancelled. The adapter ACKs and
dispatches each returned event. The transport is responsible for the
Socket Mode ACK contract and for suppressing the bot’s own echo
(returning SlackInboundEvent::Ignore or skipping it).Auto Trait Implementations§
impl !Freeze for RealSlackTransport
impl !RefUnwindSafe for RealSlackTransport
impl !UnwindSafe for RealSlackTransport
impl Send for RealSlackTransport
impl Sync for RealSlackTransport
impl Unpin for RealSlackTransport
impl UnsafeUnpin for RealSlackTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more