之前在社区里看到过有人出现过这个问题,但是现在找了半天也找不到,忘记在哪了,大神能不能帮俺看看?
public class NutzWsServer extends AbstractWsEndpoint{
@Inject Dao dao;
/**用来存放 openid---->wsid映射 **/
Map<String,String> openIdMap = new HashMap<String,String>();
@OnOpen
public void onOpen(Session session, EndpointConfig config,@PathParam("roomId") String roomId,
@PathParam("openId") String openId){//用户的openid是用来识别用户的sessionId,当需要单独推送时通过openid查找
//设置openid和wsid之间映射
openIdMap.put(openId, session.getId());
System.out.println("roomId ="+roomId+" openId="+openId);
//调用父类的open
super.onOpen(session, config);
this.roomProvider.join(roomId, session.getId());
}
控制台没有反应,没有sysout信息,但是提示成功连接了,如下
2017-11-12 13:31:35,221 org.nutz.plugins.mvc.websocket.handler.AbstractWsHandler.join(AbstractWsHandler.java:50) DEBUG - session(id=0t8cejoqp2i5gqkg1agao9onvn) join room(name=wsroom:home)