@Component
public class Sessions
extends io.netty.channel.group.DefaultChannelGroup
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ALL_SESSIONS
所有在线用户
|
static String |
PREFIX_BIND_USER_GROUP
区分
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
bindUid(io.netty.channel.Channel ch,
String userId)
绑定
|
Boolean |
bindUser(io.netty.channel.Channel ch,
String userId,
ChannelPlatform platform,
String deviceId)
绑定
|
void |
bindUser(io.netty.channel.Channel ch,
String userId,
String deviceId)
绑定
|
Object |
getAttr(io.netty.channel.Channel ch,
String key)
获取
|
String |
getClientIP(io.netty.channel.Channel ch)
获取客户端IP
|
String |
getUId(io.netty.channel.Channel ch)
获取 bindUser设定的UID
|
void |
kick(Session session)
集群通知 Session上线
|
void |
send(String uid,
Transportable msg)
向用户发送消息[含集群]
|
io.netty.channel.group.ChannelGroupFuture |
sends(io.netty.channel.group.ChannelMatcher matcher,
Transportable msg)
向通道Matcher匹配到的连接发送信息
|
io.netty.channel.group.ChannelGroupFuture |
sends(io.netty.channel.Channel ch,
Transportable msg)
向不包含ch的其它通道发送消息
|
void |
sends(Transportable msg)
向当前群组发送消息[不含集群]
|
<T extends Class> |
setAttr(io.netty.channel.Channel ch,
String key,
T val)
设置属性
|
add, clear, close, close, compareTo, contains, deregister, deregister, disconnect, disconnect, equals, find, flush, flush, flushAndWrite, flushAndWrite, hashCode, isEmpty, iterator, name, newCloseFuture, newCloseFuture, remove, size, toArray, toArray, toString, write, write, write, writeAndFlush, writeAndFlush, writeAndFlushremoveAlladdAll, containsAll, retainAlladdAll, containsAll, removeAll, retainAll, spliteratorparallelStream, removeIf, streampublic Sessions()
public Sessions(String name)
name - public void kick(Session session)
session - public String getClientIP(io.netty.channel.Channel ch)
ch - public String getUId(io.netty.channel.Channel ch)
ch - public <T extends Class> void setAttr(io.netty.channel.Channel ch, String key, T val)
T - ch - key - val - public void bindUid(io.netty.channel.Channel ch,
String userId)
public Boolean bindUser(io.netty.channel.Channel ch, String userId, ChannelPlatform platform, String deviceId)
ch - userId - platform - public void sends(Transportable msg)
msg - public void send(String uid, Transportable msg)
uid - msg - public io.netty.channel.group.ChannelGroupFuture sends(io.netty.channel.Channel ch,
Transportable msg)
ch - msg - public io.netty.channel.group.ChannelGroupFuture sends(io.netty.channel.group.ChannelMatcher matcher,
Transportable msg)
matcher - 通道匹配表达式msg - 消息体Copyright © 2020–2022 The AIM Project. All rights reserved.