通过ioc注入上述的MyWebsocket
@Inject
protected MyWebsocket myWebsocket;
public void sayhi(String wsid) {
myWebsocket.sendJson(wsid, new NutMap("action", "layer").setv("msg", "hi"));
}
public void sayhi(Httpsession session) {
myWebsocket.sendJson(session.getId(), new NutMap("action", "layer").setv("msg", "hi"));
}
这个里面的wsid 我该传什么呢,在主模块中式试了httpsession,取到的id和 onopen中 wsid存的数据不一致,直接用session时为空。