I would like to know if getId() method from javax.websocket.Session and getId() method from javax.servlet.http.HttpSession always share the same JSESSIONID.
NB: I know that those two methods are implementation dependent, and I didn't find a link between those two session id on the internet/documentation.
Goal: A client connects to my website (a JSESSIONID is created) and is authentified by a login/password (client object is linked to the JSESSIONID), then he uses website's chat ... will he be recognized by his session id from the websocket ?
=> If the anwser is "no, it's not always the same", could you propose an alternative solution ? Thanks
答案 0 :(得分:1)
websocket Session和HttpSession
的ID不相关。
一个简单的原因是与服务器端HttpSession
关联的客户端可以有多个websocket会话,这些会话都需要一个自己唯一的ID。