Skip to content

Commit

Permalink
attzonko#28 re-establish ws connection
Browse files Browse the repository at this point in the history
  • Loading branch information
gotlium committed Dec 11, 2016
1 parent de38593 commit 92c4012
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mattermost_bot/mattermost.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import requests
import websocket
import websocket._exceptions

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -186,7 +187,12 @@ def messages(self, ignore_own_msg=False, filter_action=None):
if not self.connect_websocket():
return
while True:
data = self.websocket.recv()
try:
data = self.websocket.recv()
except websocket._exceptions.WebSocketException:
if not self.connect_websocket():
raise
continue
if data:
try:
post = json.loads(data)
Expand Down

0 comments on commit 92c4012

Please sign in to comment.