Push Notifications through BES/BIS , BlackBerry

后端 未结 2 1827
我在风中等你
我在风中等你 2021-01-06 03:43

I am trying to use push notifications for OS < 7.X .

I downloaded the sample server / client code. I deployed the client code on my device and the low-level-sampl

2条回答
  •  伪装坚强ぢ
    2021-01-06 04:07

    I think all the right things have been said here, but I'm hoping we can consolidate some of the answers, and wrap this question up.

    You haven't shared your code, which makes things more difficult, but many people use the RIM/BlackBerry provided PushDemo source, where a connection suffix is hardcoded in /pushdemo/com/rim/samples/device/push/PushUtils.java:

    private static String getConnectionSuffix() {
        return ";deviceside=false;ConnectionType=mds-public";
    }
    

    I'm also guessing this from having read your other question.

    By doing this, you've hardcoded the BlackBerry transport type of BIBS. BlackBerry supports many different transports, like BES, BIS, BIBS, or WAP. The BIBS transport will send the request from your device, out to BlackBerry's servers, which are on the internet. (Note: this part is probably confusing to an iOS/Android developer, since those platforms don't provide Apple/Google network intermediaries to relay normal HTTP/S traffic)

    Then, the request is relayed to your server, which is at:

    196.84.32.112:8443
    

    I'm pretty sure that TCP/IP endpoint is not available from the Internet (I can't reach it). So, that's why it fails for you.

    You can take this URL

    https://196.84.32.112:8443/low-level-sample
    

    and paste it into your BlackBerry device's browser, and it will work. Your device is configured for BES, which uses your company's internal servers. Those internal servers can reach the 196.84.32.112:8443 endpoint, so it seems to work for you. But, that's because you haven't hardcoded the transport, as you have in the push code that uses getConnectionSuffix(). The device browser is smart enough to figure out a transport that works, and BES works to reach that intranet server.

    Hopefully, that explains the confusing part.

    Solutions

    As others have said, a solution is to get your company's IT people to make IP address 196.84.32.112 and port 8443 accessible through their firewall. That would allow the BlackBerry servers to reach it successfully.

    Another solution would be to change the PushUtils.java code to avoid the BIBS transport:

    private static String getConnectionSuffix() {
        return ";deviceside=false";
    }
    

    If you want really flexible code, then I'd suggest rewriting that PushUtils.java code, because it appears to use the pre-5.0 HTTP connection logic. ConnectionFactory in OS 5.0+ makes this easier, and more robust, when supporting multiple transports ...

    To answer your question about supporting users with multiple transports, take a look at this blackberry.com example, specifically the MyConnectionFactory class. It allows you to select which transports your app allows, and which it tries first.

    Ultimately, the decision to make your server public or not depends on how it's going to be used, and whether you'll have non-corporate internet clients trying to register with your corporate server.

提交回复
热议问题