Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
getOpenSessions() dando valor vacío [ ]

Estoy intentando guardar las sesiones en Set allSession , pero el método getOpenSessions() crea una matriz vacía. Mi código se parece a -

 @OnOpen public void onOpen(Session session){ System.out.println(session.getId() + " has opened a connection"); System.out.println(" Session: "+session.getOpenSessions()); try { session.getBasicRemote().sendText("Connection Established"); } catch (IOException ex) { ex.printStackTrace(); } }

Entonces, me está dando un resultado:

1 ha abierto una conexión

Sesión []

¿Alguien puede sugerir cuál es el problema exacto aquí?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Lo siento por la respuesta tardía. El error fue Tomcat versión 8.0. Tomcat 7 es más estable. Estoy usando esto desde hace 3,4 meses, pero se acerca un problema relacionado con la sesión. Espero que esta información te ayude.

over 4 years ago · Santiago Trujillo Report

0

Tengo el mismo problema... pero cuando utilicé el método en el método de anotación @onMessage... funciona bien... el conjunto muestra los elementos...

over 4 years ago · Santiago Trujillo Report

0

¡Esto funcionó!

 @OnMessage public String echo(String msg) throws IOException { Set<Session> set1 = wsSession.getOpenSessions(); System.out.println("set: "+set1); Iterator<Session> iter = set1.iterator(); while(iter.hasNext()) { System.out.println("entered inside while"); } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!