hololinked.server.zmq.message.EventMessage
Bases: ResponseMessage
Event message class for handling events in the system.
Message indices:
| Index | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| Desc | address | header | payload | preserialized payload |
Source code in repo/hololinked/hololinked/server/zmq/message.py
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
Attributes
byte_array
property
The message in bytes, either after being composed or as received from the socket.
Message indices:
| Index | 0 | 2 | 3 | 4 |
|---|---|---|---|---|
| Desc | address | header | data | pre encoded data |
Functions
__init__
Source code in repo/hololinked/hololinked/server/zmq/message.py
craft_from_arguments
classmethod
craft_from_arguments(event_id: str, sender_id: str, message_type: str = EVENT, payload: SerializableData = SerializableNone, preserialized_payload: PreserializedData = PreserializedEmptyByte) -> EventMessage
Create a plain message with a certain type, for example a handshake message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
id of the event (used by ZMQ pub-sub) |
required |
|
str
|
id of the sender (ZMQ socket identity) |
required |
|
str
|
message type to be sent ( |
EVENT
|
|
SerializableData
|
event payload to send to the client |
SerializableNone
|
|
PreserializedData
|
pre-encoded data, generally used for large or custom data that is already serialized |
PreserializedEmptyByte
|
Returns:
| Type | Description |
|---|---|
EventMessage
|
the crafted message |
Source code in repo/hololinked/hololinked/server/zmq/message.py
parse_header
Parse the header.
Raises:
| Type | Description |
|---|---|
ValueError
|
if the header is neither a header struct nor bytes |