Skip to content

Commit

Permalink
Fix #1025 websocket_client based SocketModeClient may fail in on_clos…
Browse files Browse the repository at this point in the history
…e callback (#1026)
  • Loading branch information
seratch committed May 28, 2021
1 parent 97a5250 commit ef81a8d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions slack_sdk/socket_mode/websocket_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,15 @@ def on_error(ws: WebSocketApp, error: Exception):
for listener in self.on_error_listeners:
listener(ws, error)

def on_close(ws: WebSocketApp):
def on_close(
ws: WebSocketApp,
close_status_code: Optional[int] = None,
close_msg: Optional[str] = None,
):
if self.logger.level <= logging.DEBUG:
self.logger.debug("on_close invoked")
self.logger.debug(
f"on_close invoked: (code: {close_status_code}, message: {close_msg})"
)
if self.auto_reconnect_enabled:
self.logger.info("Received CLOSE event. Going to reconnect...")
self.connect_to_new_endpoint()
Expand Down

0 comments on commit ef81a8d

Please sign in to comment.