Link to home
Start Free TrialLog in
Avatar of crasher88
crasher88

asked on

Developing Instant Messenging in J2ME

Hi, I'm trying to develop an IM using J2ME.

So i need to build an IM server, IM MIDlet client install in my mobile.
The tools i'm using is JBuilder with Mobile set and Tomcat server.

So what else do i need ?
If i have a wireless card install in my notebook, is it poosible that my mobile are able to communicate with my notebook? How?

Is urgent.
Thanks a lot.
Avatar of jimmack
jimmack

You have everything you need.  I've written a chat system using J2ME talking to a Tomcat server.  You might find that the concept of IM is quite tricky to implement since there is no concept of "push" technology in J2ME (MIDP-1.0).  This means that you are going to have to constantly poll the server to find out if any new messages are available.  There are two issues here:

1) If the client handset is using GSM to connect to the network, the user will have to be paying for the call whilst they use the system.

2) If the client handset is using GPRS to connect to the network, the user will have to pay for all the data transferred to and from the server.  This means that you need to be careful about the frequency and size of network traffic.

Your mobile can't communicate with your notebook through your wireless card.  The mobile isn't on the local area network.

If you want to do this, you might be able to use bluetooth, but you'll need a bluetooth card for your PC and a mobile that has support for the J2ME bluetooth APIs.
Avatar of crasher88

ASKER

If i can't connect mobile and notebook together, then i'll use J2ME Wireless Toolkit from Sun Microsystems. They have a simulator to help me test on it.

Is it poosible to do that? How?
Yes.  The J2ME toolkit has a built in simulator and a variety of devices (from minimum phone up to large full-colour phones).

Just make sure you have the normal Java 2 SDK installed first (1.3.1 or higher)

Then download and install the J2MEWTK (1.0.4 if you want MIDP1.0 support for current phones or 2.0 if you want MIDP2.0 support for phones that are only just being released).

You can install both and there are no conflicts.
If that's all for now, could you "accept" an answer to close the question ;-)

Thanx.

Jim.
jimmack, what you told me i have already know it.

Maybe i didn't clearly ask my question.
My question is how does J2ME WTK works? How it really works? From what i can see, it just compile, build and executes.

What i want to know is, the inner of J2ME WTK. How does the simulator works?

In my developing of IM, how does the client and server communicates? How it works?

Thanks.
How the chat system should work...
The server must sit and wait for connections to be requested.  If you're using a read-made http server (eg. I use Tomcat), then you can create a servlet to handle connection requests.  When a request is received, the server needs to be maintaining a list of users and rooms.  If the users is posting a message, it should be written to the room to be made available to other users in that room.  If the user is requesting messages, all appropriate messages in the room should be returned to the user.
The client application needs to know the URL of the server and the format of the parameters that should be sent.  It should allow users to create and send messages and should also allow them to see the messages in a room.

How the client and server communicate...
Using standard http URLs for the communication is easier than writing your own server from scratch.

How the J2ME WTK works...
Basically just what you've said.  The wtk allows you to compiler the Java code you create, it helps to manage your projects, creates the jar file with the correct details and allows you to emulate the application.  How the emulator works is not relevant.  If you are interested in ensuring that an application works on a specific kind of phone (eg. Nokia), then download the proprietary development kit for that manufacturer/phone.
When you run a network enabled application on the emulator, it will be able to access a server on your local machine or network and on the Internet, just as you can with your web browser.
Thanks alot jimmack. It really helps me in getting to know more about developing the IM application.

One more thing, Is there any interface (eg. a screen, a log file to keep any record of sessions) in the server side?

Do you mind to print screen the interface of the server side with client side and send it to me? My email address is patrick_sor@hotmail.com

After that the points is yours.

Thanks...

I manage the sessions (rooms) in a MySQL database.

If you want to see the interface, you can look at the user guide:

http://www.ossmobile.co.uk/mCOM/mCOM_User_Guide.jsp
Is that what you wanted?
Is there any server-side interface?

Sorry for the trouble, but i need it to do my research for the IM application...

Thanks a lot..
Yes.  Sorry, when I read your last comment again, I realised that was what you actually asked for ;-)

Basically it's a JSP that contains a table.  The table is two columns wide.  One each row I have a text area that contains the complete content of the "room" and in the second column I have a list of the users that are active in the room (in another text area).

A second JSP page allows me to enter messages for users to pick up when they next contact the server.

I would give you access to the administration pages, but I'm currently discussing the sale of the application ;-)
jimmack, as you have said, You maintain a room in a chat system, but in instant messaging? How to I do it? Chat is a little different from instant messaging. I pass the message straight to the other user or I store it in the database?

Ok, lets say I want to sent a message from mobile1 to mobile2. How do I do that? Can I point to the username that is unique so that it will sent to the specific user?


Can you please explain in more detail regarding the format of the parameters that should be sent?
ASKER CERTIFIED SOLUTION
Avatar of jimmack
jimmack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you jimmack.
How to contact you? If i have questions regarding this project, can i email you and ask for your opinions?

Here's your points. Thanks a lot.

Thanx ;-)

Probably best to ask further questions in this TA.  It's against EE policy to take discussions away from the community.  However, I'll probably be around and I always check this TA for new questions.

You might find other experts with different opinions or ideas that may even be more suitable for your needs at the time ;-)

Good luck with the project :-)