WebSocket增加getSncpAddress方法,获取分布式下的sncp地址
This commit is contained in:
@@ -83,6 +83,8 @@ public abstract class WebSocket<G extends Serializable, T> {
|
||||
|
||||
WebSocketEngine _engine; //不可能为空
|
||||
|
||||
InetSocketAddress _sncpAddress; //分布式下不可为空
|
||||
|
||||
AsyncConnection _channel;//不可能为空
|
||||
|
||||
String _sessionid; //不可能为空
|
||||
@@ -826,6 +828,15 @@ public abstract class WebSocket<G extends Serializable, T> {
|
||||
return forceCloseWebSocket(getUserid()).thenApply((r) -> true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分布式情况下的SNCP地址, 非分布式下为null
|
||||
*
|
||||
* @return InetSocketAddress sncpAddress
|
||||
*/
|
||||
public InetSocketAddress getSncpAddress() {
|
||||
return _sncpAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Logger
|
||||
*
|
||||
|
||||
@@ -209,6 +209,7 @@ public abstract class WebSocketServlet extends HttpServlet implements Resourcabl
|
||||
webSocket._sendConvert = sendConvert;
|
||||
webSocket._remoteAddress = request.getRemoteAddress();
|
||||
webSocket._remoteAddr = request.getRemoteAddr();
|
||||
webSocket._sncpAddress = this.node.localSncpAddress;
|
||||
initRestWebSocket(webSocket);
|
||||
CompletableFuture<String> sessionFuture = webSocket.onOpen(request);
|
||||
if (sessionFuture == null) {
|
||||
|
||||
Reference in New Issue
Block a user