Table of Contents

Class ModelSubscription

Namespace
DuetControlServer.IPC.Processors
Assembly
DuetControlServer.dll

Subscription processor that notifies clients about object model changes. There is no point in deserializing the object model here so only the JSON representation is kept here.

public sealed class ModelSubscription : IProcessor
Inheritance
ModelSubscription
Implements
Inherited Members

Constructors

ModelSubscription(Connection, ClientInitMessage, Filter, ObjectModel, Observer, ILogger<ModelSubscription>, IOptions<Settings>)

Constructor of the subscription processor

public ModelSubscription(Connection conn, ClientInitMessage initMessage, Filter filter, ObjectModel model, Observer observer, ILogger<ModelSubscription> logger, IOptions<Settings> settings)

Parameters

conn Connection

Connection instance

initMessage ClientInitMessage

Initialization message

filter Filter

Filter to access the machine model

model ObjectModel

Object model

observer Observer

Observer to receive property change notifications

logger ILogger<ModelSubscription>

Logger instance

settings IOptions<Settings>

Settings

Properties

Connection

Connection to the IPC client served by this processor

public Connection Connection { get; }

Property Value

Connection

HasClientsWaitingForMessages

Check if there are any clients waiting for generic messages

public static bool HasClientsWaitingForMessages { get; }

Property Value

bool

SupportedCommands

List of supported commands in this mode

public static Type[] SupportedCommands { get; }

Property Value

Type[]

Methods

GetPathNode(Dictionary<string, object?>, object[])

Get the dictionary or list object using a path node to record properties

public static object? GetPathNode(Dictionary<string, object?> root, object[] path)

Parameters

root Dictionary<string, object>

Root dictionary

path object[]

Path node

Returns

object

Item at the given path

ProcessAsync(CancellationToken)

Task that keeps pushing model updates to the client

public Task ProcessAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token to cancel the worker

Returns

Task

Task that represents the lifecycle of a connection

Record a new message based on the message flags

public static void RecordMessage(MessageTypeFlags flags, Message message)

Parameters

flags MessageTypeFlags

Message flags

message Message