Skip to content

Commit

Permalink
Fix slackapi#1025 websocket_client based SocketModeClient may fail in…
Browse files Browse the repository at this point in the history
… on_close callback
  • Loading branch information
seratch committed May 28, 2021
1 parent 35e2246 commit ec20407
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions slack_sdk/socket_mode/websocket_client/__init__.py
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 ec20407

Please sign in to comment.