Skip to content

Commit cb04f66

Browse files
committed
partial fix for sessionid generation
1 parent 3b32c1a commit cb04f66

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/org/iris_events/router/ws/SocketV1.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ private boolean checkForBannedClient(Map<String, List<String>> headers) {
9595
@OnOpen
9696
public void onOpen(Session session, EndpointConfig conf) {
9797
try {
98-
final var irisSessionId = (String) conf.getUserProperties().get(IRIS_SESSION_ID_HEADER);
98+
//final var irisSessionId = (String) conf.getUserProperties().get(IRIS_SESSION_ID_HEADER);
99+
// todo session id should be generated while doing handshake as it is returned as header on upgrade,
100+
// but there is no reliable way to share state between ws configurator and endpoint, for now we are generating it here,
101+
// which will break mdc session id tracking between clients end backend, but better than having same session id for multiple web socket sessions.
102+
final var irisSessionId = UUID.randomUUID().toString();
99103
MDC.put(MDCProperties.SESSION_ID, irisSessionId);
100104

101-
102-
103105
Map<String, List<String>> headers = Optional
104106
.ofNullable((Map<String, List<String>>) conf.getUserProperties().remove("headers"))
105107
.orElse(Collections.emptyMap());

0 commit comments

Comments
 (0)