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 <https://tools.ietf.org/html/rfc6455#section-7.4.1>`_. ``reason`` may be
(self, code: Optional[int] = None, reason: Optional[str] = None)
| 490 | pass |
| 491 | |
| 492 | def close(self, code: Optional[int] = None, reason: Optional[str] = None) -> None: |
| 493 | """Closes this Web Socket. |
| 494 | |
| 495 | Once the close handshake is successful the socket will be closed. |
| 496 | |
| 497 | ``code`` may be a numeric status code, taken from the values |
| 498 | defined in `RFC 6455 section 7.4.1 |
| 499 | <https://tools.ietf.org/html/rfc6455#section-7.4.1>`_. |
| 500 | ``reason`` may be a textual message about why the connection is |
| 501 | closing. These values are made available to the client, but are |
| 502 | not otherwise interpreted by the websocket protocol. |
| 503 | |
| 504 | .. versionchanged:: 4.0 |
| 505 | |
| 506 | Added the ``code`` and ``reason`` arguments. |
| 507 | """ |
| 508 | if self.ws_connection: |
| 509 | self.ws_connection.close(code, reason) |
| 510 | self.ws_connection = None |
| 511 | |
| 512 | def check_origin(self, origin: str) -> bool: |
| 513 | """Override to enable support for allowing alternate origins. |
no outgoing calls
no test coverage detected