Diffusion .NET Client Library
6.1.5
|
Represents a stream interface that can be registered to receive topic subscription, value and delta events. More...
Public Member Functions | |
void | OnSubscription (string topicPath, ITopicDetails details) |
Called when a session is subscribed to a topic that matches the stream registration. More... | |
void | OnUnsubscription (string topicPath, TopicUnsubscribeReason reason) |
Called if the session is unsubscribed from a topic that matches the stream registration. More... | |
void | OnTopicUpdate (string topicPath, IContent content, IUpdateContext context) |
This indicates an update to the state of a topic that is subscribed to. More... | |
Public Member Functions inherited from PushTechnology.ClientInterface.Client.Callbacks.IStream | |
void | OnClose () |
Notification that a stream context was closed normally. More... | |
Public Member Functions inherited from PushTechnology.ClientInterface.Client.Callbacks.ICallback | |
void | OnError (ErrorReason errorReason) |
Notification of a contextual error related to this callback. More... | |
Represents a stream interface that can be registered to receive topic subscription, value and delta events.
When using this type of stream it is the responsibility of the application to interpret delta events and apply them to any locally held values. For some types the use of a IValueStream{TValue} is much simpler.
A stream implementation is registered using ITopics.AddTopicStream(string, ITopicStream). The stream will receive events for all topics that are matched by the topic selector with which it is registered.
A stream implementation can also be registered as a fallback stream using ITopics.AddFallbackTopicStream. Fallback streams will receive events for all topics that are not selected by other streams the session has registered using ITopics.AddStream{TValue}(ITopicSelector,IValueStream{TValue}) or ITopics.AddTopicStream(ITopicSelector,ITopicStream).
If the stream is removed, Callbacks.IStream.OnClose will be called.
If the session is closed Callbacks.IStream.OnError(ErrorReason) will be called with ErrorReason.SESSION_CLOSED.
Since 5.1
void PushTechnology.ClientInterface.Client.Features.ITopicStream.OnSubscription | ( | string | topicPath, |
ITopicDetails | details | ||
) |
Called when a session is subscribed to a topic that matches the stream registration.
This method is also called when a stream is added, for all of the session's subscriptions to topics that match the stream registration.
For a given topic, OnSubscription will be the initial notification, and the first notification following an OnUnsubscription notification if the session re-subscribes to the topic.
This method is also called for fallback streams if the session removes the last stream (ITopics.RemoveStream) that selected a subscribed topic. The fallback stream will now receive updates for the topic, starting with an immediate notification of the currently cached value (if any).
topicPath | The full topic path. |
details | The basic topic details. |
Implemented in PushTechnology.ClientInterface.Client.Features.TopicStreamDefault.
void PushTechnology.ClientInterface.Client.Features.ITopicStream.OnTopicUpdate | ( | string | topicPath, |
IContent | content, | ||
IUpdateContext | context | ||
) |
This indicates an update to the state of a topic that is subscribed to.
Both value and delta updates are notified via this method and the supplied context will indicate which.
If the stream is added with a selector which matches topics to which the session is already subscribed, and the topic type is TopicType.JSON, TopicType.BINARY or TopicType.SINGLE_VALUE, this will be called after the subscription notification to provide the current known value. For other topic types, the current value is not retained by the client, and the next update received could be a delta. For such topics it is important to add streams before subscription.
topicPath | The full topic path. |
content | The topic content. The context can contain more information about the nature of the content. |
context | The update context which can indicate whether the content represents the total state or a change to the state. |
Implemented in PushTechnology.ClientInterface.Client.Features.TopicStreamDefault.
void PushTechnology.ClientInterface.Client.Features.ITopicStream.OnUnsubscription | ( | string | topicPath, |
TopicUnsubscribeReason | reason | ||
) |
Called if the session is unsubscribed from a topic that matches the stream registration.
The stream will receive no more updates for the topic unless the session re-subscribes to the topic.
This method is also called for fallback streams if the session adds the first stream (ITopics.AddTopicStream(ITopicSelector,ITopicStream)) that selects a subscribed topic. For these notifications, reason will be TopicUnsubscribeReason.STREAM_CHANGE. The fallback stream will no longer receive updates for the topic.
topicPath | The full topic path. |
reason | The reason for unsubscription. |
Implemented in PushTechnology.ClientInterface.Client.Features.TopicStreamDefault.