🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Acting on object
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

Publish notifications to another system

MDrivenServer event communication uses SignalR to send notifications between systems. A receiving server-side ViewModel subscribes to an event, and a publishing server-side ViewModel triggers that event.

Define the event

Use an eventguid as the shared event identifier. The documentation describes this as a unique string that makes the event unique at the instance level and that is shared by the sender and subscriber.

Value Used by Meaning
eventguid Subscriber and sender The shared identifier for the event.
eventcookie Subscriber The value returned to the subscriber when the event is received. A suggested value is Viewmodel=SomeVM&RootId= followed by an external ID.
eventdata Sender An optional string. It is not currently used by an MDrivenServer receiver.
eventRemoveAfterSend Sender An optional Boolean that defaults to false. When true, the client is notified only once.

Use the event as a notification signal rather than as a sensitive-data channel. If the receiver needs further details, it can follow up with an authenticated RestGet protected by AccessGroups.

Subscribe to an event

  1. In the receiving server-side ViewModel, create an action column named RealtimeSubscribeToEvent.
  2. Set realtimehub to the MDrivenServer URL of the publishing system. Leave it blank to subscribe to the current system.
  3. Set eventguid to the shared event identifier.
  4. Set eventcookie to the information needed when the receiver handles the event, for example Viewmodel=RefreshOrder&RootId= followed by self.externalid.

RealtimeSubscribeToEvent can be called multiple times. For a server and event-guid combination, only the latest event cookie is retained. A blank event cookie, or an event cookie equal to endsubscription, removes the subscription.

Trigger an event

  1. In the publishing server-side ViewModel, create an action column named RealtimeTriggerEvent.
  2. Set its eventguid to the identifier shared with subscribers.
  3. Optionally set eventdata and eventRemoveAfterSend.
  4. Execute the action when the publishing system needs to notify subscribers.

When the trigger action executes, the publishing MDrivenServer calls ReceiveEvent for connected listening clients that match the event GUID. Subscribers receive the event GUID, their own client cookie, and event data.

Receiver handling

For an MDrivenServer receiver, the event cookie returned by ReceiveEvent(theEventGuid, theEventCookie) is used to create a SysAsyncTicket with the ViewModel and RootId from the cookie.

A non-MDrivenServer subscriber must support the SignalR API:

method SubscribeToEvent(string eventguid, string clientcookie);

event ReceiveEvent(string eventguid, string ClientCookie, string eventData);

The non-MDrivenServer subscriber parses the client cookie that it supplied when subscribing and handles the event as needed.

Security

Events are open and unauthenticated. Do not send sensitive data over events. Use events to trigger a just-in-time RestGet protected by AccessGroups.

See also