I am developing an application where from my android app it triggers an event about my JSF web application, I have made it through the use of websockets.
My problem is showing the data received by the websocket in my xhtml view when the method annotated with @onMessage is executed.
Then my endpoint class
@ServerEndpoint(value = "/despacho")
public class DespachoNotificationEndPoint implements Serializable{
public static List<String> listaValores = new ArrayList<>();
@OnMessage
public void messageRecive(Session s, String message) {
getListaValores().add(message);
System.out.println(message);
}
@OnOpen
public void onOpen(Session s) {
/*código cuando se abre la conexión websocket*/
}
@OnClose
public void onClose(Session s) {
/*método cuando se cierra la conexión websocket*/
}
public static void resetResource() {
getListaValores().clear();
}
public static List<String> getListaValores() {
return listaValores;
}
public static void setListaValores(List<String> listaValores) {
DespachoNotificationEndPoint.listaValores = listaValores;
}
}