Please Wait

Loading..

Multiplexing Messaging

Subscribe multiple channels on a single connection

Easily Learn in 2 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 Multiple Channels -->
<script type="text/javascript">
SubscribeMessage({
    ChannelName: 'YourChannel1,YourChannel2,YourChannel3',
    Callback: function (message, channel, acknowledgement) {
        // Shows alert when message receive
        alert(message);
    }
});
</script>
                            

//Subscribe to Multiple Channels. 
List<string> channels = new List<string>(); 
channels.Add("YourChannel1"); 
channels.Add("YourChannel2"); 
channels.Add("YourChannel3");
yalgaar.Subscribe(channels, SubscribeReturnMessage, SubErrorMessage);

//shows message box when message subscribe public void SubscribeReturnMessage(string Channel, string message) { MessageBox.Show(Message); } //shows message box when Error occur private void SubErrorMessage(string Message) { MessageBox.Show(Message); }

//Subscribe to Multiple Channels. 
List<string> channels = new ArrayList<string>(); 
channels.Add("YourChannel1"); 
channels.Add("YourChannel2"); 
channels.Add("YourChannel3");
yalgaar.subscribe(channels, subscriptionCallback, null);
                            
//print when message subscribe public void subscriptionCallback(string message) { System.out.println(message); }

//Subscribe to Multiple Channels
NSArray *arrSubChannels = [NSArray arrayWithObject:@”YourChannel1”, @”YourChannel2”, nil];
[objYalgaarClient subscribeWithChannels: arrSubChannels 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 with multiple channels

To subscribe message with multiple channels on which the message will be published, use the methods shown in the tabs. Channel name is CASE SENSITIVE.


Try another tutorials