(self, session: Session = None)
| 165 | return conn |
| 166 | |
| 167 | def _send_msg_to_client(self, session: Session = None): |
| 168 | conn = self._get_active_connection() |
| 169 | session = session or self.session |
| 170 | |
| 171 | if not conn or conn.closed(): |
| 172 | return |
| 173 | |
| 174 | for msg in session.get_task_commands(): |
| 175 | try: |
| 176 | conn.write_message(msg) |
| 177 | except TypeError as e: |
| 178 | logger.exception('Data serialization error: %s\n' |
| 179 | 'This may be because you pass the wrong type of parameter to the function' |
| 180 | ' of PyWebIO.\nData content: %s', e, msg) |
| 181 | except Exception: |
| 182 | logger.exception("Error in sending message via websocket") |
| 183 | |
| 184 | def _close_from_session(self): |
| 185 | conn = self._get_active_connection() |
no test coverage detected