samedi 23 juillet 2016

How to filter on the onopen method from which html the websocket was opened?

on the onopen method can I know from wich .html the request came from ? so I can make an if out of that and do my stuff? I have index.html and chat.html I need to do different things on different loads

@ServerEndpoint("/proyecto")enter code here public class controlador { static ArrayList Usuarios = new ArrayList(); private static final Set sessions = Collections.synchronizedSet(new HashSet());

@OnOpen
public void onOpen(Session s) {
    System.out.println(s.getId() + " abrió conexión");
    sessions.add(s);
    loopUsuariosId(s);
    broadcastMsg("nuevousu", s);         
}

Aucun commentaire:

Enregistrer un commentaire