22
33import java .io .IOException ;
44import java .security .NoSuchAlgorithmException ;
5- import java .util .Collections ;
6- import java .util .List ;
7- import java .util .Map ;
8- import java .util .Objects ;
9- import java .util .Optional ;
10- import java .util .UUID ;
5+ import java .util .*;
116
127import io .quarkus .logging .Log ;
138import jakarta .annotation .PostConstruct ;
@@ -101,10 +96,12 @@ public void onOpen(Session session, EndpointConfig conf) {
10196 // which will break mdc session id tracking between clients end backend, but better than having same session id for multiple web socket sessions.
10297 final var irisSessionId = UUID .randomUUID ().toString ();
10398 MDC .put (MDCProperties .SESSION_ID , irisSessionId );
99+ session .getUserProperties ().put (IRIS_SESSION_ID_HEADER , irisSessionId );
104100
105101 Map <String , List <String >> headers = Optional
106- .ofNullable ((Map <String , List <String >>) conf .getUserProperties ().remove ("headers" ))
107- .orElse (Collections .emptyMap ());
102+ .ofNullable (new HashMap <>((Map <String , List <String >>) conf .getUserProperties ().remove ("headers" )))
103+ .orElse (new HashMap <>());
104+ headers .put (IRIS_SESSION_ID_HEADER , List .of (irisSessionId ));
108105
109106 headers .forEach ((k , v ) -> MDC .put ("header." +k , v .toString ()));
110107
@@ -121,7 +118,6 @@ public void onOpen(Session session, EndpointConfig conf) {
121118
122119
123120 var userSession = websocketRegistry .startSession (session , headers );
124- conf .getUserProperties ().put ("user-session" , userSession );
125121
126122 } finally {
127123 MDC .clear ();
0 commit comments