$(function(){
if (!Notification) {
return;
}
if (console)
console.info(Notification.permission);
if (Notification.permission == "denied") {
return;
}
5 回复
public void onMessage(String message) {
try {
NutMap msg = Json.fromJson(NutMap.class, message);
String action = msg.getString("action");
if (Strings.isBlank(action))
return;
String room = msg.getString("room");
switch (action) {
case "join":
join(room);
break;
case "left":
left(room);
break;
default:
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void join(String room) {
if (!Strings.isBlank(room)) {
log.debugf("session(id=%s) join room(name=%s)", uu32, room);
try (Jedis jedis = jedisPool.getResource()) {
rooms.add(room);
jedis.hset(NutzbookWebsocket.prefix+room, uu32, "");
}
}
}
这些代码的作用,装入redis中,然后可以通知在线的用户吗
添加回复
请先登陆