Integrating pubnub in Ionic 2

You are aware of Ionic 2 framework and already setup the app. If not, please follow Installing Ionic to setup your environment.
You already setup pubnub on server side and publishing the events on particular channel.
The first step is to add the pubnub into your html file. You can either include a cdn or copy the script locally and add it to your html. I will be including the following cdn in my head tag.
The next step is to download a pubnub.ts SDK:
 In the above code, if you look into the connectionuuid(uuid) I am calling the server to get the subscription key (You can hard code the subscription key for security reasons I am getting from server)). Once I got the subscription key I am initializing pubnub and setting isReady to true. Whoever what to listen to any channel, they can do so by calling listen method of pubnub service.


Next Post Previous Post
6 Comments
  • TOMSYS
    TOMSYS 2/25/2017 10:09:00 am

    Nice! Thanks for the tips!

  • Unknown
    Unknown 7/01/2017 10:47:00 am

    vcxvcv

  • Unknown
    Unknown 1/04/2018 05:12:00 pm

    Hi, I have followed your tutorials, but didnt understand how you are creating channels in one to one chat? I am struggling to get the idea of creating channels in the case of one to one chat. Could you please help me with it?

    • Anonymous
      Anonymous 1/30/2018 12:51:00 pm

      https://www.pubnub.com/docs/web-javascript/pubnub-javascript-sdk
      please follow this link...

  • Anonymous
    Anonymous 1/30/2018 12:51:00 pm

    This comment has been removed by the author.

  • srikanth
    srikanth 5/12/2018 02:35:00 pm

    Do you ever think of about the credit card which you get many offers to your profile
    capitol one.com

Add Comment
comment url