websocket Notes

***************************** Description ******************** ********

1. Each connection session.getId () will be different

2. We websocket program maintains a Map, record player id ---> session of the relationship;

***************************************************************

1. When will establish correspondence relations if the relationship already exists, to update the session (used here to illustrate oldSession and newSession). OldSession best we manually shut down (session.close () implementation of the program will jump to go inside onClose , onClose then play back the implementation of the code execution session.close () ---- this feature should be noted that under)

Exception occur onClose 2. runtime; network anomaly triggers onError, general onError and removes session as onClose relations;

3. The client will transfer onClose to trigger onClose server, preventing onOpen immediately after the client onClose, onOpen request First, this case will clear onClose map of the session, we must determine the relationship when clearing the Map of sesson id is the same as the current sessionId .

 

Guess you like

Origin www.cnblogs.com/trump2/p/11586615.html