4 Replies Latest reply on Jun 6, 2016 9:41 AM by steven12810303

    Trying to use PubNub java object - the "hereNow" method.

    steven12810303

      I have included the Pubnub-4.0.0.jar file into my webroot.

      (Pubnub-4.0.0.jar can be downloaded here: https://www.pubnub.com/docs/java/pubnub-java-sdk-v4)

       

      I am trying to get the “HERE NOW” java code into my coldfusion project and am having some trouble in doing so.

       

      The java code is as follows:

      PNConfiguration pnConfiguration = new PNConfiguration();

      pnConfiguration.setSubscribeKey("SubscribeKey")  

      PubNub pubnub = new PubNub(pnConfiguration);

      pubNub.hereNow()

          .channels(Arrays.asList("ch1", "ch2", "ch3")) // who is present on those channels?

          .includeState(true) // include state with request (false by default)

          .includeUUIDs(true) // if false, only shows occupancy count

          .async(new PNCallback<PNHereNowResult>() {

              @Override

              public void onResponse(PNHereNowResult result, PNStatus status) {

       

              }

          });

       

      My corresponding Coldfusion code is as follows:

      <cfobject type="java" class="com.pubnub.api.PNConfiguration" name="objPNConfiguration" >

      <cfset PNConfiguration = objPNConfiguration.init() >

      <cfset PNConfiguration.setSubscribeKey("SubscribeKey") >

      <cfobject type="java" class="com.pubnub.api.PubNub" name="objPubNub" >

      <cfset pubnub = objPubNub.init(PNConfiguration) >

      <cfset tmp = pubnub.hereNow({channels: "ch1"}) >

      <cfdump var="#tmp#" >

       

      I do not get any errors returned.

      I feel the way in which I am calling the “hereNow” method is incorrect or the way in which I am trying to display the results is incorrect.

       

      Can anyone provide any assistance with regards to this?

      Thanks