Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Problem to subscribe to the server push

 

Hi guys,

The Following code not does work, please let me know the possible Problems and What You Should Take steps before.

Thanks
<script>
  var port = ####; // This is the port that I assign rim. I'm doing this wrong?
  function doMySubscription()
  {
     //See if they have a BIS transport.. if so use it
     var transports = blackberry.system.getTransportList();
     found = false;
     for (var i = 0; i < transports.length; i++)
     {
         if (transports[i].name == "BIS")
         {
             found = true;
             blackberry.push.openPushListener(handleMyReturnData, port, transport[i]);
             break;
         }
     }
     if (!found)
         blackberry.push.openPushListener(handleMyReturnData, port);
  }
  function handleMyReturnData(data)
  {
      if (data != null)
      {
         var myRecievedData= blackberry.utils.blobToString(data.payload)
         alert(myRecievedData);
      else
         alert("No data from the push");
  }
  function cancelSubscription()
  {
      blackberry.push.closePushListener(port);
  }
</script>

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Problem to subscribe to the server push

Are you pushing data from your corporate BES (BlackBerry Enterprise Server) or from the public BIS service?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: Problem to subscribe to the server push

BIS

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Problem to subscribe to the server push

This thread should help you get started in the right direction.

 

http://supportforums.blackberry.com/t5/Web-Development/How-do-I-connect-widget-to-BIS-eval-push-serv...

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: Problem to subscribe to the server push

I try to do step by step and still maintain the problem.

It is possible to have an example where being sent and received a message of hello world