generated from pufereq/python-template
Compare commits
2 Commits
332ce3ffa1
...
2ef4adaaa1
| Author | SHA1 | Date | |
|---|---|---|---|
|
2ef4adaaa1
|
|||
|
aa0703fcde
|
@@ -181,3 +181,20 @@ class Message:
|
|||||||
acknowledged=False,
|
acknowledged=False,
|
||||||
ack_required=True,
|
ack_required=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def close(cls) -> Message:
|
||||||
|
"""Create a CLOSE message.
|
||||||
|
Prompts the recipient to close the connection and not reconnect.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Message: The created CLOSE message.
|
||||||
|
"""
|
||||||
|
return cls(
|
||||||
|
id_=None,
|
||||||
|
category=Category.CONTROL,
|
||||||
|
action=ControlAction.CLOSE,
|
||||||
|
payload={},
|
||||||
|
acknowledged=False,
|
||||||
|
ack_required=True,
|
||||||
|
)
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ class Category(str, Enum):
|
|||||||
class ControlAction(str, Enum):
|
class ControlAction(str, Enum):
|
||||||
HELLO = "hello"
|
HELLO = "hello"
|
||||||
ACK = "ack"
|
ACK = "ack"
|
||||||
|
CLOSE = "close"
|
||||||
|
|||||||
Reference in New Issue
Block a user