Closes this Web Socket. Once the close handshake is successful the socket will be closed. ``code`` may be a numeric status code, taken from the values defined in `RFC 6455 section 7.4.1 `_. ``reason`` may be
(self, code: Optional[int] = None, reason: Optional[str] = None)
| 466 | pass |
| 467 | |
| 468 | def close(self, code: Optional[int] = None, reason: Optional[str] = None) -> None: |
| 469 | """Closes this Web Socket. |
| 470 | |
| 471 | Once the close handshake is successful the socket will be closed. |
| 472 | |
| 473 | ``code`` may be a numeric status code, taken from the values |
| 474 | defined in `RFC 6455 section 7.4.1 |
| 475 | <https://tools.ietf.org/html/rfc6455#section-7.4.1>`_. |
| 476 | ``reason`` may be a textual message about why the connection is |
| 477 | closing. These values are made available to the client, but are |
| 478 | not otherwise interpreted by the websocket protocol. |
| 479 | |
| 480 | .. versionchanged:: 4.0 |
| 481 | |
| 482 | Added the ``code`` and ``reason`` arguments. |
| 483 | """ |
| 484 | if self.ws_connection: |
| 485 | self.ws_connection.close(code, reason) |
| 486 | self.ws_connection = None |
| 487 | |
| 488 | def check_origin(self, origin: str) -> bool: |
| 489 | """Override to enable support for allowing alternate origins. |
no outgoing calls
no test coverage detected