dimanche 26 juillet 2015

JEE6 TomEE 1.7.2: How does one associate a websocket with a user's session?

@ServerEndpoint("/websocket/blah")
public class LeadChangeWebsocketEndpoint {
 @Inject
 private SessionScopedBean bean;

 @OnOpen
 public void onOpen(Session session) {
  bean.takeWebsocketAndDoSomething(session);
 }
....
}

That code results in an exception. How does one associate a websocket with a user's session? I can't find any documentation explicitly stating what the CDI scope of a @ServerEndpoint bean is, even though it is capable of receiving CDI injections.

Aucun commentaire:

Enregistrer un commentaire