|
◆ reply()
def websocketd.Httpd.reply |
( |
|
self, |
|
|
|
connection, |
|
|
|
code, |
|
|
|
message = None , |
|
|
|
content_type = None , |
|
|
|
headers = None , |
|
|
|
close = False |
|
) |
| |
Reply to a request for a document.
There are three ways to call this function:
- With a message and content_type. This will serve the data as a normal page.
- With a code that is not 101, and no message or content_type. This will send an error.
- With a code that is 101, and no message or content_type. This will open a websocket.
- Parameters
-
connection | Requesting connection. |
code | HTTP response code to send. Use 200 for a valid page. |
message | Data to send (as bytes), or None for an error message just showing the response code and its meaning. |
content_type | Content-Type of the message, or None if message is None. |
headers | Headers to send in addition to Content-Type and Content-Length, or None for no extra headers. |
close | True if the connection should be closed after this reply. |
- Returns
- None.
Definition at line 1201 of file websocketd.py.
|