DataSource.NET  7.1.13.29686-d434448
Caplin.DataSource.Messaging.JSON.IJsonMessage Interface Reference

Interface for sending IJsonMessage messages. More...

Inheritance diagram for Caplin.DataSource.Messaging.JSON.IJsonMessage:
Caplin.DataSource.Messaging.IMessage

Public Member Functions

bool isPatch ()
 Checks if the JSON object is a patch. More...
 

Properties

string Json [get]
 Gets the the JSON object string. More...
 
- Properties inherited from Caplin.DataSource.Messaging.IMessage
bool Image [get, set]
 Gets or sets a boolean value indicating whether this IMessage represents an image or an update. More...
 
string Subject [get]
 Gets the subject of this message. More...
 

Detailed Description

Interface for sending IJsonMessage messages.

These messages may be images or patches as defined in RFC 6902.

The initial message sent should be a JSON image.

The example below demonstrates sending a JSON image message.

namespace DataSourceExamples.Messaging.JSON
{
class SendingAJSONImage
{
void SendJSONImage(IPublisher publisher, string subject)
{
string jsonImage = "{\"hello\":\"world\"}";
// Create a JSON image message.
IJsonMessage message = publisher.MessageFactory.CreateJsonImageMessage(subject, jsonImage);
// Send the message to subscribed peers.
publisher.PublishToSubscribedPeers(message);
}
}
}

The example below demonstrates sending a JSON patch message.

namespace DataSourceExamples.Messaging.JSON
{
class SendingAJSONPatch
{
void SendJSONPatch(IPublisher publisher, string subject)
{
string jsonPatch = "[{\"op\":\"add\",\"path\":\"/bob\",\"value\":\"new\"}]";
// Create a JSON patch message.
IJsonMessage message = publisher.MessageFactory.CreateJsonPatchMessage(subject, jsonPatch);
// Send the message to subscribed peers.
publisher.PublishToSubscribedPeers(message);
}
}
}

Member Function Documentation

bool Caplin.DataSource.Messaging.JSON.IJsonMessage.isPatch ( )

Checks if the JSON object is a patch.

True if the object is a patch, false if it's an image.

Property Documentation

string Caplin.DataSource.Messaging.JSON.IJsonMessage.Json
get

Gets the the JSON object string.

The JSON text. This may represent a JSON image or a JSON patch.


Generated on Fri Apr 24 2020 16:29:45 for DataSource.NET