pub struct SceneStreamHandler<B: SceneBackend> { /* private fields */ }websocket only.Expand description
The SceneStreamEnable / SceneStreamDisable /
SceneInteractionEvent handler of one WebSocket connection; see the
module docs.
SceneStreamEnablereplaces the subscription throughSceneEphemeralSubscription::replace_with, orSceneEphemeralSubscription::replace_with_observewhenSceneBackend::supports_observe. Its error becomes theRequestError(invalidArguments, orforbiddenwithregionIdsfor a refused observer subscription, with the message’sidasrequestId) and leaves the subscription unchanged; “This error does not close the WebSocket connection”. A malformed message isnotRequest.SceneStreamDisableclears it, silently, whether or not one was active. The"scene"path ofChatStreamEnableis unaffected.SceneInteractionEventis 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>
impl<B: SceneBackend> SceneStreamHandler<B>
Sourcepub fn new(
backend: Arc<B>,
caller: B::CallerCtx,
recipient_account_id: Id,
hub: &SceneEventHub,
) -> Self
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.
Sourcepub fn with_limits(self, limits: SceneStreamLimits) -> Self
pub fn with_limits(self, limits: SceneStreamLimits) -> Self
Replace the outbound rate limit.
Sourcepub fn chat_alias(&self) -> SceneChatAlias
pub fn chat_alias(&self) -> SceneChatAlias
The "scene" switch of this connection’s ChatStreamEnable
subscription; off until set.
Sourcepub fn subscription(&self) -> SceneEphemeralSubscription
pub fn subscription(&self) -> SceneEphemeralSubscription
The connection’s current SceneStreamEnable subscription.
Trait Implementations§
Source§impl<B: SceneBackend> Debug for SceneStreamHandler<B>
impl<B: SceneBackend> Debug for SceneStreamHandler<B>
Source§impl<B: SceneBackend> Drop for SceneStreamHandler<B>
impl<B: SceneBackend> Drop for SceneStreamHandler<B>
Source§impl<B: SceneBackend> ExtensionHandler for SceneStreamHandler<B>
impl<B: SceneBackend> ExtensionHandler for SceneStreamHandler<B>
Source§fn message_types(&self) -> &[&str]
fn message_types(&self) -> &[&str]
@types this handler takes. Read once, by
Connection::with_extension.Source§fn start(&mut self, events: ExtensionSender)
fn start(&mut self, events: ExtensionSender)
Source§async fn handle(&mut self, message: ExtensionMessage) -> Result<(), JmapError>
async fn handle(&mut self, message: ExtensionMessage) -> Result<(), JmapError>
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).