Question

Has anyone managed to integrate a Pubnub service into Sencha Touch yet?

I was thinking about just including the library that constantly makes the requests but not quite sure how it will react to everything else. Wondering if anyone has actually got a proper solution yet and if this will work with Native, which I guess makes requests and will work as normal anyway?

Thanks, Dom

Was it helpful?

Solution

Yes, this certainly is possible. To test it out, I made a chat example.

Live demo here

Code here

To integrate PubNub, the minified javascript library is included in /resources/js and added to the project in app.json like this:

{
    "path": "resources/js/pubnub-3.1.min.js"
},

Then, in app.js, in launch(), add this:

var pubnub = PUBNUB.init({
    publish_key   : 'demo',
    subscribe_key : 'demo',
    ssl           : false,
    origin        : 'pubsub.pubnub.com'
});

From there, you can use pubnub.publish() and pubnub.subscribe() like normal.

Hope this helps.

OTHER TIPS

Or just use websockets. It's easy to work with like SocketIO

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top