Please Wait

Loading..

Message Storage

Store your message data stream for future retrieval.

Easily Learn in 4 steps

1. Connect To YALGAAR

The first step is to sign up to Yalgaar using our get started form. You can get in your dashboard in under few seconds. In your dashboard there is a demo app created, click on it and go to App Information page. You can see your client key. To connect to a Yalgaar use your client key.


<!-- Include the Yalgaar Library -->
<script src="yalgaar.js" type="text/javascript"> </script>

<!-- Connect to Yalgaar with your client key --> <script type="text/javascript"> ConnectToYalgaar({ ClientKey: 'YourClientKey', SSL: false, Callback: function (acknowledgement) { }, Error: function (err) { } }); </script>

//Required .Net Framework 4.5 or above

//Using Yalgaar library using YalgaarNet;
//Connect to Yalgaar with your client key YalgaarClient yalgaar = new YalgaarClient("YourClientKey", false, ConnectionCallback);
//Create object of Yalgaar client with context of application
YalgaarApiClient objYalgaarClient = new YalgaarApiClient.Builder(context).build();
                            
//Connect to a Yalgaar client with your client key yalgaar.connect("YourClientKey", false, ConnectionCallback);

//iOS device with version 7.1 or above. 

//create an object of YalgaarClient class. YalgaarClient *objYalgaarClient = [[YalgaarClient alloc] init];
//Connect to Yalgaar with your client key [objYalgaarClient connectWithClientKey:@"YourClientKey" IsSecure: YES Error:&error]; //called when connection done successfully (void) didConnected{ }

For more languages, 
check out Yalgaar SDK & Documentation page
SDK & Documentation
                                                          


<!-- Subscribe to YourChannel -->
<script type="text/javascript">
SubscribeMessage({
    ChannelName: 'YourChannel',
    Callback: function (message, channel, acknowledgement) {
        // Shows alert when message receive
        alert(message);
    }
});
</script>
                            

//Subscribe to YourChannel
yalgaar.Subscribe("YourChannel", SubscribeReturnMessage, SubErrorMessage);
                            
//shows message box when message subscribe public void SubscribeReturnMessage(string Topic, string message) { MessageBox.Show(Message); } //shows message box when Error occur private void SubErrorMessage(string Message) { MessageBox.Show(Message); }

//Subscribe to YourChannel
yalgaar.subscribe("YourChannel", subscriptionCallback, null);
                            
//print when message subscribe public void subscriptionCallback(string message) { System.out.println(message); }

//Subscribe to YourChannel
[objYalgaarClient subscribeWithChannel:@”YourChannel” Error:&error];
                                                                                          
//called when receive data 
(void) dataReceivedForSubscription:(NSString *)data OnChannels:(NSArray *)Channels{
    NSLog(@"Data received: %@", data);
}
                            

For more languages, 
check out Yalgaar SDK & Documentation page
SDK & Documentation
                                                          

2. Subscribe Message

Now you are Connected to Yalgaar, you can publish or subscribe message. Lets Subscribe channel first before publishing the message. To subscribe message use channel name on which message will be published. Channel name is CASE SENSITIVE and only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.


3. Publish Message

After subscribing channel you can then publish messages to that channel. Channel name is CASE SENSITIVE and only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.


<!-- Publish simple message to YourChannel -->
<script type="text/javascript">
PublishMessage({
    ChannelName: 'YourChannel',
    Message: 'This is Yalgaar Message Storage Example',
    Callback: function (acknowledgment) {
    }
});
</script>
                            

//Publish simple message to YourChannel
yalgaar.Publish("YourChannel", "This is Yalgaar Message Storage Example");
                            

//Publish simple message to YourChannel
yalgaar.publish("YourChannel", "This is Yalgaar Message Storage Example", publishCallback);
                            

//Publish message to YourChannel
[objYalgaarClient publishWithChannel:@"YourChannel" Message:@"This is Yalgaar Message Storage Example" Error:&error];
                            

For more languages, 
check out Yalgaar SDK & Documentation page
SDK & Documentation
                                                          


<!-- Detailed history of previously published messages -->
<!-- Maximum records returned is = 100 -->
<script type="text/javascript">
GetHistory({
    ChannelName: 'YourChannel',
    MessageCount: 100,
    Callback: function (message, err) {
    }
});
</script>
                            

// Detailed history of previously published messages
// Maximum records returned is = 100
yalgaar.GetHistory("YourChannel", 100, HistoryMessageCallback, ErrorMsgCallback);

//NOTE: HistoryMessageCallback and ErrorMsgCallback are callback methods.
                            

// Detailed history of previously published messages
// Maximum records returned is = 100
yalgaar.messageHistory("YourChannel", 100, HistoryCallback);

//NOTE: HistoryCallback is callback method
                            

// Detailed history of previously published messages
// Maximum records returned is = 100
[objYalgaarClient messageHistoryWithChannel:@"YourChannel" Count:100 Error:&err];

//Note: In response of above function call, below delegate will be called.
// (void) dataReceivedForMessageHistroy:(NSArray*)data;
                            

For more languages, 
check out Yalgaar SDK & Documentation page
SDK & Documentation
                                                          

4. Get History Message

As long as the Message storage feature is enabled for your account, you can get maximum last 100 messages for particular channel.


Try another tutorials