Communication Extensions

We have been using communication extensions all over the documentation. All samples from server-side code where we use Invoke, InvokeTo, InvokeToAll are RPC/RMI extensions. All samples with Publish, PublishTo and PublishToAll are Publish/Subscribe extensions.

A Custom Extension

Below we see the simple code of 2 controllers and a simple extension that let us target clients on a specific controller based on state.

The 2 controllers (sensor and monitor) is very basic. The Sensor controller has a single method that takes a sensor value and sends it to the custom extension named SendToMonitoringClients. The Monitor controller only has a property (Threshold), this property is used in the custom extension to target clients that has the threshold set to

The custom extension is decorated with where T : class, IXSocketController so that we can call this from any XSocketscontroller (not only the Sensor controller).