The community forums are in BETA and closed to the public.

getting two pubnub instance from javascript sdk Titanium

Hey , i'm creating Titanium app and i had successfully integrated it with pubnub js sdk but my problem now that i creating another app on my account and i want to do each step i did before twice what i did for now is

   Ti.include("/lib/pubnub.js");

    var pubnub_user = PUBNUB.init({
        publish_key : 'pub-c-f34d03c5-3bc6-4fd9-b8d5-e1d501f2671e',
        subscribe_key : 'sub-c-3606e5f2-a627-11e4-a65a-02ee2ddab7fe',
        ssl : false,
        native_tcp_socket : false,
        origin : 'pubsub.pubnub.com'
    });

    var pubnub_agent = PUBNUB.init({
        publish_key : 'pub-c-c605c57f-cf4e-47cb-acff-6dac8b2050d1',
        subscribe_key : 'sub-c-abcc2b3a-d133-11e4-85c8-02ee2ddab7fe',
        ssl : false,
        native_tcp_socket : false,
        origin : 'pubsub.pubnub.com'
    });

and then i created two chennels and both created successfully but when i try to publish or receive any message on pubnubagent i can't even if i can publish and subscribe the other channels on pubnubuser

(channel on pubnub_agent is working and if i tried to publish or subscribe it from another app every things are normal )

Can you share your publish/subscribe code?

pubnub_agent.subscribe({
                    channel : 'chat' + myData.id,
                    //restore:true,
                    callback : function(message) {
                        console.log('hi1');

                    },
                    error : function(e) {
                        console.log(e);
                    }
                });
                   pubnub_user.subscribe({
                    channel : 'chat' + myData.id,
                    //restore:true,
                    callback : function(message) {
                        console.log('hi');

                    },
                    error : function(e) {
                        console.log(e);
                    }
                });

Tony, if you use ~~~ at the top and bottom of you code it will format properly. See Markdown Syntax Guide for more details.

Tony, I reread your question/issue but I am not able to understand what you are saying. Can you try that again (reword). Thanks/sorry.

i'm following a feedback from you about sending push notification between two pubnub app and you solution was to publish twice on two channel so for that i need two pubnub instance and when i did that i only get on of them working


Comments to this discussion are now closed!