pub struct SceneEphemeralSubscription { /* private fields */ }Expand description
The ephemeral Scene subscription of one WebSocket connection.
The default value is inactive, which is the state before the first
SceneStreamEnable and after a SceneStreamDisable.
Implementations§
Source§impl SceneEphemeralSubscription
impl SceneEphemeralSubscription
Sourcepub fn replace_with(
&mut self,
enable: &SceneStreamEnable,
) -> Result<(), JmapError>
pub fn replace_with( &mut self, enable: &SceneStreamEnable, ) -> Result<(), JmapError>
Replaces this subscription with the one in enable.
The new frame “REPLACES any previous SceneStreamEnable
subscription in its entirety”; nothing is merged from it.
Unrecognized eventTypes values next to recognized ones are dropped
(draft-atwood-jmap-scene-wss-00 §SceneStreamEnable, Semantics).
§Errors
Returns an invalidArguments JmapError when eventTypes is an
empty array or holds only values outside SCENE_EVENT_TYPES. On
error self is unchanged, as the draft requires. The transport
sends the error as an RFC 8887 §4.3.4 RequestError frame whose
type is the full URN
"urn:ietf:params:jmap:error:invalidArguments" and whose
requestId is SceneStreamEnable::id when the client sent one;
the returned JmapError carries the short method-level name. The
connection stays open.
This is the form for a server that does not advertise
supportsObserve: SceneStreamEnable::observe “is recognized
only when the server advertises supportsObserve”, so it is
ignored here. A server that advertises it uses
Self::replace_with_observe.
Sourcepub fn replace_with_observe(
&mut self,
enable: &SceneStreamEnable,
) -> Result<(), JmapError>
pub fn replace_with_observe( &mut self, enable: &SceneStreamEnable, ) -> Result<(), JmapError>
As Self::replace_with, for a server that advertises
supportsObserve (draft-atwood-jmap-scene-wss-00 at jmap-chat-spec
93f2258): SceneStreamEnable::observe true makes the
subscription an observer subscription (SceneStreamFilter::observes).
Whether a listed region may be observed (allowObservers, the
server’s policy) is the transport’s check before it commits the
subscription: “When observe is true and a listed region that the
user has access to has allowObservers set to false, or the
server declines observers of it by policy, the server MUST respond
with a RequestError … forbidden”. The websocket handler does
it.
§Errors
As Self::replace_with, and an invalidArguments JmapError
when observe is true and regionIds is null or absent: “the
server MUST respond with a RequestError of type
\"urn:ietf:params:jmap:error:invalidArguments\" and MUST NOT
update the current ephemeral subscription state, because an
observer subscription names its regions”. On error self is
unchanged.
Sourcepub fn filter(&self) -> Option<&SceneStreamFilter>
pub fn filter(&self) -> Option<&SceneStreamFilter>
The active filters, or None when no subscription is enabled.