Cross Platform Mobile Applications

Asynchronous and full duplex communication over HTTP

The most popular communication method in Java ME is HTTP (Hypertext Transfer Protocol), or HTTP Secure for improved security. HTTP defines both a transport mechanism and a basic protocol. Its original purpose was to retrieve hypertext pages over the internet, but is today used for a range of purposes. In mBricks we use HTTP as a transport mechanism for our own protocol which is transferred in the body of HTTP post requests/responses.

The benefits of an HTTP based communication protocol are multiple. There are, for example, few or no firewall issues. A multitude of technologies exist, such as application servers and load balance systems, built around and on the protocol.

Along with all the positive aspects of a HTTP based communications there are also some drawbacks. HTTP follows a request-response paradigm. This means that the client sends a request to the server, which processes it and sends back a response. The communication is synchronous and the channel is blocked until the server returns a response. This could lead to a halt of the application, or even a connection timeout. In the first case, the user experience will suffer but if a timeout occurs the response will never become available for the user, and thus the application fails. Timeout will, however, happen more often in a mobile environment than on the internet. HTTP functionality, like Keep Alive, is not implemented.

To overcome these problems we utilize two connections in mBricks, one connection for sending requests from the client to the server, and one for receiving all the responses from the server. This will enable both an asynchronous and a full duplex paradigm. Application halts and timeouts are no longer an issue. This paradigm is much like AJAX, except that we, of course, uses Java and not Java Script, and have our own binary protocol.

The mBricks networks specify three queues with different priority and utilize two HTTP connections, see system drawing:

Key benefits with the mBricks network is:

- Queues with different priorities

- Possibility to cancel messages

- Sending messages directly from the server to the client (HTTP Push)

- No timeout problems

Links:

http://blogs.sun.com/mobility_techtips/entry/asynchronous_communications_with_java_me

http://developers.sun.com/mobility/midp/ttips/soacalls/

Leave a Reply

mBricks © 2010. All rights reserved