Skip to main content

SceneStreamHandler

Struct SceneStreamHandler 

Source
pub struct SceneStreamHandler<B: SceneBackend> { /* private fields */ }
Available on crate feature websocket only.
Expand description

The SceneStreamEnable / SceneStreamDisable / SceneInteractionEvent handler of one WebSocket connection; see the module docs.

  • SceneStreamEnable replaces the subscription through SceneEphemeralSubscription::replace_with, or SceneEphemeralSubscription::replace_with_observe when SceneBackend::supports_observe. Its error becomes the RequestError (invalidArguments, or forbidden with regionIds for a refused observer subscription, with the message’s id as requestId) and leaves the subscription unchanged; “This error does not close the WebSocket connection”. A malformed message is notRequest.
  • SceneStreamDisable clears it, silently, whether or not one was active. The "scene" path of ChatStreamEnable is unaffected.
  • SceneInteractionEvent is validated and relayed, never answered.
  • Closing the connection clears the subscription and stops delivery (§Subscription Lifecycle).

Each of these that changes which regions the connection observes reports it to SceneBackend::set_observing.

Implementations§

Source§

impl<B: SceneBackend> SceneStreamHandler<B>

Source

pub fn new( backend: Arc<B>, caller: B::CallerCtx, recipient_account_id: Id, hub: &SceneEventHub, ) -> Self

The handler of a connection authenticated as caller, whose own account is recipient_account_id (the account whose Chat capability the blocked-sender check consults, as should_deliver takes it), receiving events from and relaying interactions to hub.

The default SceneStreamLimits apply.

§Panics

Does not panic: the expect on the catch-all subscription holds because SceneEphemeralSubscription::replace_with fails only on an eventTypes array with no recognized value, and the default SceneStreamEnable has eventTypes null.

Source

pub fn with_limits(self, limits: SceneStreamLimits) -> Self

Replace the outbound rate limit.

Source

pub fn chat_alias(&self) -> SceneChatAlias

The "scene" switch of this connection’s ChatStreamEnable subscription; off until set.

Source

pub fn subscription(&self) -> SceneEphemeralSubscription

The connection’s current SceneStreamEnable subscription.

Trait Implementations§

Source§

impl<B: SceneBackend> Debug for SceneStreamHandler<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: SceneBackend> Drop for SceneStreamHandler<B>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<B: SceneBackend> ExtensionHandler for SceneStreamHandler<B>

Source§

fn message_types(&self) -> &[&str]

The client-to-server @types this handler takes. Read once, by Connection::with_extension.
Source§

fn start(&mut self, events: ExtensionSender)

Called once before the first message, with the queue for this connection’s server-to-client extension messages. The default drops it.
Source§

async fn handle(&mut self, message: ExtensionMessage) -> Result<(), JmapError>

Process one message. Success sends nothing (the drafts’ control messages are not acknowledged: “success is silent and failure produces a RequestError”). Err is sent as an RFC 8887 §4.3.4 RequestError with the message’s id as requestId, through RequestHandler::prepare_problem; its extra members become problem-details members (for example the Scene draft’s regionIds on a forbidden error).
Source§

async fn close(&mut self)

Called once when the connection ends. The default does nothing.

Auto Trait Implementations§

§

impl<B> !RefUnwindSafe for SceneStreamHandler<B>

§

impl<B> !UnwindSafe for SceneStreamHandler<B>

§

impl<B> Forget for SceneStreamHandler<B>

§

impl<B> Freeze for SceneStreamHandler<B>
where Arc<Shared<B>>: Freeze,

§

impl<B> Move for SceneStreamHandler<B>

§

impl<B> Send for SceneStreamHandler<B>
where Arc<Shared<B>>: Send,

§

impl<B> Sync for SceneStreamHandler<B>
where Arc<Shared<B>>: Sync,

§

impl<B> Unpin for SceneStreamHandler<B>
where Arc<Shared<B>>: Unpin,

§

impl<B> UnsafeUnpin for SceneStreamHandler<B>
where Arc<Shared<B>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more