i trying implement web socket session manager , have encountered road block hope can assist me with.
basically client initiate web socket session websocket server endpoint , take http request parameters, parse , subscribe web service producer endpoint. web service return response containing subscription identifier of use key mapping (along http session id) add java map cache session object. proceed send data published webservice consumer endpoint. application take data received producer, use subscription id comes each packet , find right session in map caches send data to.
here problem..
i noticed if client opens tab in browser , sends second subscription request, still sent same http session id yet tomcat still able stream data correct tab. implies tomcat websocket implementation has built in multiplex handling mechanism.
to exclude unnecessary details unless asked, want to able identify channels multiplexed under same session id. can't find way in api identify it. need able map caches , remove sessions tabs have been closed (which triggers close method in web socket endpoint), i'm not going able there many sockets/channels associated same http session id.
the websocket framework not provide such implementation. every tab opens new socket. can maintain session info through adding key in request while initiating websocket , on message check key(eg jsession id value) in server , serve request accordingly.
Comments
Post a Comment