- java.lang.Object
-
- org.redkale.net.http.WebSocketNode
-
- org.redkale.net.http.WebSocketNodeService
-
- 所有已实现的接口:
Service
- 直接已知子类:
WebSocketNodeService
@AutoLoad(false) @ResourceType(WebSocketNode.class) public class WebSocketNodeService extends WebSocketNode implements Service
详情见: https://redkale.org- 作者:
- zhangjx
-
-
字段概要
-
从类继承的字段 org.redkale.net.http.WebSocketNode
localEngine, localSncpAddress, logger, messageAgent, name, nodeid, remoteNode, semaphore, sendConvert, source, WS_SOURCE_KEY_NODES, WS_SOURCE_KEY_USERID_PREFIX, wsNodeAddress
-
-
构造器概要
构造器 构造器 说明 WebSocketNodeService()
-
方法概要
-
从类继承的方法 org.redkale.net.http.WebSocketNode
broadcastAction, broadcastMessage, broadcastMessage, broadcastMessage, broadcastMessage, broadcastMessage, broadcastMessage, broadcastMessage, broadcastMessage, existsWebSocket, existsWebSocket, forceCloseWebSocket, forceCloseWebSocket, formatRemoteMessage, getLocalWebSocketEngine, getMessageAgent, getName, getRpcNodeAddresses, getRpcNodeWebSocketAddresses, getSemaphore, getUserSet, getUserSize, postDestroy, releaseSemaphore, remoteWebSocketAddresses, sendAction, sendAction, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendOneAddrAction, sendOneAddrMessage, sendOneUserAction, sendOneUserMessage, tryAcquireSemaphore, userAddressToAddrMap, userAddressToUserids
-
-
-
-
方法详细资料
-
init
public void init(AnyValue conf)
从接口复制的说明:Service
该方法必须是可以重复调用, 当reload时需要重复调用init方法 远程模式下该方法会重载成空方法- 指定者:
init
在接口中Service
- 覆盖:
init
在类中WebSocketNode
- 参数:
conf
- 配置参数
-
destroy
public void destroy(AnyValue conf)
从接口复制的说明:Service
进程退出时,调用Service销毁 远程模式下该方法会重载成空方法 注意: 在此方法内不能调用MessageClient.sendMessage 方法,因为Application关闭时会先destroy掉MessageClient- 指定者:
destroy
在接口中Service
- 覆盖:
destroy
在类中WebSocketNode
- 参数:
conf
- 配置参数
-
setName
public final void setName(String name)
-
getWebSocketAddresses
public CompletableFuture<List<String>> getWebSocketAddresses(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress, Serializable groupid)
- 指定者:
getWebSocketAddresses
在类中WebSocketNode
-
sendMessage
public CompletableFuture<Integer> sendMessage(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress, Object message, boolean last, Serializable... userids)
- 指定者:
sendMessage
在类中WebSocketNode
-
broadcastMessage
public CompletableFuture<Integer> broadcastMessage(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress, WebSocketRange wsrange, Object message, boolean last)
- 指定者:
broadcastMessage
在类中WebSocketNode
-
sendAction
public CompletableFuture<Integer> sendAction(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress, WebSocketAction action, Serializable... userids)
- 指定者:
sendAction
在类中WebSocketNode
-
broadcastAction
public CompletableFuture<Integer> broadcastAction(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress, WebSocketAction action)
- 指定者:
broadcastAction
在类中WebSocketNode
-
getUserSize
public CompletableFuture<Integer> getUserSize(@RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress)
- 指定者:
getUserSize
在类中WebSocketNode
-
connect
public CompletableFuture<Void> connect(Serializable userid, WebSocketAddress wsaddr)
当用户连接到节点,需要更新到CacheSource- 指定者:
connect
在类中WebSocketNode
- 参数:
userid
- Serializablewsaddr
- WebSocketAddress- 返回:
- 无返回值
-
disconnect
public CompletableFuture<Void> disconnect(Serializable userid, WebSocketAddress wsaddr)
当用户从一个节点断掉了所有的连接,需要从CacheSource中删除- 指定者:
disconnect
在类中WebSocketNode
- 参数:
userid
- Serializablewsaddr
- WebSocketAddress- 返回:
- 无返回值
-
changeUserid
public CompletableFuture<Void> changeUserid(Serializable olduserid, Serializable newuserid, WebSocketAddress wsaddr)
更改用户ID,需要更新到CacheSource- 指定者:
changeUserid
在类中WebSocketNode
- 参数:
olduserid
- Serializablenewuserid
- Serializablewsaddr
- WebSocketAddress- 返回:
- 无返回值
-
existsWebSocket
public CompletableFuture<Boolean> existsWebSocket(Serializable userid, @RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress)
判断用户是否有WebSocket- 指定者:
existsWebSocket
在类中WebSocketNode
- 参数:
userid
- Serializabletopic
- RpcTargetTopictargetAddress
- InetSocketAddress- 返回:
- 无返回值
-
forceCloseWebSocket
public CompletableFuture<Integer> forceCloseWebSocket(Serializable userid, @RpcTargetTopic String topic, @RpcTargetAddress InetSocketAddress targetAddress)
强制关闭用户的WebSocket- 指定者:
forceCloseWebSocket
在类中WebSocketNode
- 参数:
userid
- Serializabletopic
- RpcTargetTopictargetAddress
- InetSocketAddress- 返回:
- 无返回值
-
-