feat(message.py): add CLOSE msg constructor

This commit is contained in:
2025-11-19 21:24:08 +01:00
parent aa0703fcde
commit 2ef4adaaa1

View File

@@ -181,3 +181,20 @@ class Message:
acknowledged=False,
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,
)