declearn.communication.utils.verify_client_messages_validity
Verify that received serialized messages match an expected type.
- If all received messages matches expected type, deserialize them.
- If any received message is an unexpected
Error
message, send anError
to non-error-send clients, then raise. - If any received message belongs to any other type, send an
Error
to each and every client, then raise.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
netwk |
NetworkServer
|
|
required |
received |
Dict[str, SerializedMessage]
|
Received |
required |
expected |
Type[MessageT]
|
Expected |
required |
Returns:
Name | Type | Description |
---|---|---|
messages |
Dict[str, MessageT]
|
Deserialized messages from |
Raises:
Type | Description |
---|---|
ErrorMessageException
|
If any |
MessageTypeException
|
If any |
Source code in declearn/communication/utils/_parse.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|