Paid Job - App Builder - App example for PubNub.


Adrian Brookbank

Hi all,

I have an small opportunity for someone to create a small demo example client to client AB project using PubNub platform.

Will be using the PhoneGap JS SDK.

https://www.pubnub.com/docs/phonegap-javascript/pubnub-javascript-sdk#how_to_get_it_cdn

The allocated budget is 80 Euros.Please PM me for more details if you are interested.

Cheers,

AJ


DecSoft

Hello to all,

The services that PubNub offers are quite large, that is, if we just take a quick view, we can see that the number of services, the different APIs, the complexity of that APIs, etc., are not simple at all. I want to recommend the lecture of this article from Nick Brandury: Favicon Hell: Small Feature, Big Code. Basically we can know where we start... but it's no possible to know where we finish.

If I am not wrong, the particular service that you link is quite similar than the Pusher.com service offers (we have already a Pusher control in AB). Well. We start with problems, since, the Javascript SDK that we must use, apparently, is not available in the CND link that the service offer. There is no problem... we can get the code from Github, fortunatelly, so we can try to follow the service's start guide.

And, certainly, we can "simply" copy the code of the start guide and adapt it to an AB app, just like in the below way:

https://www.decsoftutils.com/_support/uploads/PubNub.zip

You must open two instances of the app to see it working, that is... a sole instance of the app works like expected, but, probably you want how the apps can interchange messages in real time, don't you? For that, run the app in AB, type an user name (like "John") and then run the app in a browser like Firefox, and, type another user name (like "Peter"), then you can see how both instances of the app can interchange messages in real time.

This means we end the work? Not at all! We just start with the work... we just follow the start guide... but we must continue working... studying the service API, probably implement lot of things in the server (we want to save the history of messages in a database?), etcetera, etcetera, etcetera. I want to finish by a quote of the refered Nick Bradbury's article:


I know that response sounds glib to those who hear it, but it’s really me being honest. If I haven’t tackled a feature in code yet, then there’s no way I can reliably estimate how long it will take to complete it.

I completely agree with Bradbury.



DecSoft

Hello to all,

I want to add something more to my previous post. :-) I am not quite sure if what you wanted is something like a chat. If so, remember the possible usage of a WebSocket server and the WebSocket control of AB. I certainly have a very good experience using this to made a more or less complex chat for a couple of apps that I develop.

Not easy! We need a dedicated server. And we need to work in the server side and the client side too, but, certainly the chat is provided by us, instead of a thirdparty server, and, on the other hand, the WebSocket server and the WebSocket control in AB works like a charm. I am very happy with their usage, at the least, and the mentioned apps' chats have features like the "online/offline" presence of the users, the "Is typing..." message and more.

The chat system for the refered app take me tons of work... but after that they works like a charm and we are very happy with that. The magic of the WebSocket server and the Websocket control is, of course, the ability to maintain a persistent communication between the app and the server side, so, we can be notified by the server in certain events.

Another thing that I want to add to my previous post is that I don't want to interfere with your offer, that is, maybe some AB user can certainly help you in your task, that is, go ahead the quick start guide that I shown in the above linked sample app, that I hope that can help you in something. :-)



Adrian Brookbank

Yes, Websocket server is an option, but with that a dedicated server is required, then you have to ensure it’s WSS sockets not just WS - then the requirement to add self signed certificates to devices if you’re running an iOS app.

Why bother with all that when a dedicated platform has the ability to manage the backend (reliably without the need for you to run a dedicated server) and with more functionality.

With Pusher, again you’re not able to initiate direct connection from JavaScript to the service without your own server via PHP, so that seems like a barrier.


And with the changes coming into play from webview to wkwebview in the iOS SDK, websockets will only work if it’s a secure and uses the wkwebview - so long term, webosckets will break in any Cordova app that’s not using the new wkwebview component.

So, That’s why using a 3rd party service to deal with the backend for messaging within apps is a better solution in my opinion, and the PubNub service allows you to do a lot more even by just using the publish and subscribe APIs.



DecSoft

Hello to all,

Yes, Websocket server is an option, but with that a dedicated server is required, then you have to ensure it’s WSS sockets not just WS - then the requirement to add self signed certificates to devices if you’re running an iOS app.

I am not sure about what you said. We use WS (not WSS) in certain app that works also in iOS like a charm.

Why bother with all that when a dedicated platform has the ability to manage the backend (reliably without the need for you to run a dedicated server) and with more functionality.

I think that nothing can offer more functionallity than a dedicated server. Of course it's not cheap than a non dedicated one, but, just the ability to run your programs, like a WebSocket server, is just amazing.

With Pusher, again you’re not able to initiate direct connection from JavaScript to the service without your own server via PHP, so that seems like a barrier.

I certainly ignore that "limitation". But, again, honestly I think that have an app's server is more or less mandatory. Maybe we no need a dedicated server, but, at least some server... in order to do what we simply can't do in the client side.

And with the changes coming into play from webview to wkwebview in the iOS SDK, websockets will only work if it’s a secure and uses the wkwebview - so long term, webosckets will break in any Cordova app that’s not using the new wkwebview component.

I am not sure about what to say on this. In principle, when the "wkwebview" become available, Cordova must support it. Then, we can be quiet on that point. Additionally, we can use certain Cordova plugin right now if we wanted to use the wkwebview instead the default one. And, if we must chante the "WS" to "WSS"... well... maybe it's a good thing to do that.

So, That’s why using a 3rd party service to deal with the backend for messaging within apps is a better solution in my opinion, and the PubNub service allows you to do a lot more even by just using the publish and subscribe APIs.

I no discuss if PubNub can be good, of course. Probably is a good service. I just place my opinion: if we wanted a chat, a Websocket server can be also fine. But, if we want to use a thirdparty server like PubNub, why not to do it?

Anyway, I am not sure if my prepared sample can be useful for you or not, since you simply don't mention it. I hope that that sample can be useful for you, of course. :-)


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.