Skip to content

Commit

Permalink
⬆️ WebSocket 出错回调处理
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 8, 2019
1 parent e1568d6 commit 0112789
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ public void onClose(final WebSocketSession session) {
public void onMessage(final Message message) {
}

/**
* Called when a error received.
*
* @param error error
*/
@Override
public void onError(final Error error) {
removeSession(error.session);
}

/**
* Removes the specified session.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,14 @@ public void onClose(final WebSocketSession session) {
@Override
public void onMessage(final Message message) {
}

/**
* Called when a error received.
*
* @param error error
*/
@Override
public void onError(final Error error) {
SESSIONS.remove(error.session);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ public void onClose(final WebSocketSession session) {
public void onMessage(final Message message) {
}

/**
* Called when a error received.
*
* @param error error
*/
@Override
public void onError(final Error error) {
removeSession(error.session);
}

/**
* Notifies the specified chat message to browsers.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,16 @@ public void onMessage(final Message message) throws JSONException {
}
}

/**
* Called when a error received.
*
* @param error error
*/
@Override
public void onError(final Error error) {
removeSession(error.session);
}

/**
* Removes the specified session.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ public void onMessage(final Message message) {
userMgmtService.updateOnlineStatus(userId, ip, true, true);
}

/**
* Called when a error received.
*
* @param error error
*/
@Override
public void onError(final Error error) {
removeSession(error.session);
}

/**
* Sends command to browsers.
*
Expand Down

0 comments on commit 0112789

Please sign in to comment.