mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Use channelId for ReactorNettyWebSocketSession's id
Closes gh-35883
This commit is contained in:
+13
-2
@@ -61,9 +61,20 @@ public abstract class NettyWebSocketSessionSupport<T> extends AbstractWebSocketS
|
||||
messageTypes.put(PongWebSocketFrame.class, WebSocketMessage.Type.PONG);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor that uses the hashcode of the delegate as the session id.
|
||||
*/
|
||||
protected NettyWebSocketSessionSupport(T delegate, HandshakeInfo info, NettyDataBufferFactory factory) {
|
||||
super(delegate, ObjectUtils.getIdentityHexString(delegate), info, factory);
|
||||
this(delegate, ObjectUtils.getIdentityHexString(delegate), info, factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of {@link #NettyWebSocketSessionSupport(Object, HandshakeInfo, NettyDataBufferFactory)}
|
||||
* with a given WebSocket session id.
|
||||
* @since 6.2.15
|
||||
*/
|
||||
protected NettyWebSocketSessionSupport(T delegate, String id, HandshakeInfo info, NettyDataBufferFactory factory) {
|
||||
super(delegate, id, info, factory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-3
@@ -64,14 +64,18 @@ public class ReactorNettyWebSocketSession
|
||||
* Constructor with an additional maxFramePayloadLength argument.
|
||||
* @since 5.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public ReactorNettyWebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound,
|
||||
HandshakeInfo info, NettyDataBufferFactory bufferFactory,
|
||||
int maxFramePayloadLength) {
|
||||
|
||||
super(new WebSocketConnection(inbound, outbound), info, bufferFactory);
|
||||
super(new WebSocketConnection(inbound, outbound), getChannelId(inbound).asLongText(), info, bufferFactory);
|
||||
this.maxFramePayloadLength = maxFramePayloadLength;
|
||||
this.channelId = ((ChannelOperations) inbound).channel().id();
|
||||
this.channelId = getChannelId(inbound);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static ChannelId getChannelId(WebsocketInbound inbound) {
|
||||
return ((ChannelOperations) inbound).channel().id();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user