DataSource.NET  7.1.23.41524-1415d4ff
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 Caplin.DataSource.Messaging.JSON.IJsonChannelMessage

Public Member Functions

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

Properties

Object JsonObject [get]
 Gets the the JSON object. More...
 
string JsonString [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

Object Caplin.DataSource.Messaging.JSON.IJsonMessage.JsonObject
get

Gets the the JSON object.

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

Gets the the JSON object string.

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


Generated on Wed Mar 2 2022 14:26:12 for DataSource.NET