users@glassfish.java.net

WebSocket Chat App

From: <forums_at_java.net>
Date: Tue, 24 Jan 2012 05:24:42 -0600 (CST)

Hi,

i try to implement an application like a chat. I am using glassfish version
3.1.2-b18 (build 18).

My on message method looks like this:

public void onMessage(WebSocket socket, String text) {           
       
        for(final WebSocket sock : getWebSockets()){
            sock.send(text);
        }
                   
        //super.onMessage(socket, text);
    }   

 

If two clients connect and one client sends a string, only the client (c1)
who sends the string, receive the answer. the other client (c2) do not get
the string from c1.

Is there another implemnation to realize a "chat" application?

best regards

hsch


--
[Message sent by forum member 'hsch']
View Post: http://forums.java.net/node/882957