9.6 SIP-Based IM Applications The current breed of J2ME Jabber clients connect to servers via permanent socket connections or through HTTP proxy servers. That is not particularly efficient for IM applications in which messages are mostly pushed to devices. In socket-based IM applications, reconnecting dropped connections is also a big problem, especially in the unreliable wireless networks. A promising new technology for mobile IM is the Session Initiation Protocol (SIP). SIP is a high-level protocol over TCP/IP. It is a signaling protocol widely used in Voice over IP (VoIP) systems.The JSRs 164 (JAIN SIMPLE Presence) and 165 (JAIN SIMPLE Instant Messaging) are community efforts to standardize SIP-based IM and presence APIs. The SIP Lite API planned by those specifications is specially designed for J2ME devices.
9.6.1 The SIP API for J2ME At the time of this writing, neither JSR 164 nor 165 are available to the general public. However, the SIP API for J2ME (JSR 180) is already in the public review stage. JSR 180 is the basis for JSRs 164/165.In the SIP API for J2ME specification, the SIP connections are defined within the J2ME Generic Connection Framework.A SipClientConnection object is created when we pass a sip:username@host.domain:port URL to the Connector.open() method. It is used to send outgoing SIP messages.A SipConnectionNotifier object is created when we pass a sip:port URL to the Connector.open() method. It listens at the specified port number for incoming SIP connections.When a new session connection comes in, the SipConnectionNotifier object creates a new SipServerConnection to respond to the request.For each session, the corresponding connection objects and other context information are persisted in the SipDialog object.As a session-oriented protocol, SIP makes it very easy to signal presence and push instant messages as needed.
|