(self)
| 107 | self.on_message(msg) |
| 108 | |
| 109 | def _disconnect(self): |
| 110 | try: |
| 111 | if self.ws: |
| 112 | self.ws.close() |
| 113 | except WebSocketConnectionClosedException as e: |
| 114 | pass |
| 115 | finally: |
| 116 | self.keepalive.join() |
| 117 | |
| 118 | self.on_close() |
| 119 | |
| 120 | def close(self): |
| 121 | self.stop = True # will only disconnect after next msg recv |