-
Notifications
You must be signed in to change notification settings - Fork 316
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Flux messages are quite large. For example an apprunningmessage:
const fluxAppRunningMsg = {
type: 'fluxapprunning',
version: 1,
name: 'Ipshow',
hash: '4da0ce332a5e8634b7a22132f4962ff4defdd2a7c3e047494728bbe1208fb3a8', // hash of application specifics that are running
ip: "12.12.12.12",
broadcastedAt: 1708252932172,
runningSince: 1708252932172,
};This gets converted to json, then used as the payload for another signed flux message. For eg:
const dataObj = {
version: 1,
timestamp: 1708252932172,
pubKey: '04f568e8dbba96b55592cbc4ca378e30fd449eb46e050743eac07aad3e04cf630a0ea5bb20c8ff38e74a0cf0c1657c155c0293d9ba08a0ed69e22e65ff4365bc53',
signature: 'IB/IEZDZr+C5aT2jNL6X26sEAmOgahTcJjIjeDZkOKFGaWzaWiWZp50t8XO5PCkoz0VQHYr1uFQ0MrKvFaAdQ08=',
data: fluxAppRunningMsg,
};Then the above message gets converted to JSON before being sent on the wire. The size of the above message is 497 bytes.
If we were to use structures, the same message would only be 187 bytes that is only 38% of the original messages size.
Something like the following:
fluxapprunning message
type uint8 1 bytes
version uint8 1 bytes
name uint8Array 32 bytes max
hash uint8Array 32 bytes
ip uint32 4 bytes
broadcast uint32 4 bytes
running uint32 4 bytes
total 78 bytes max.
generic fluxnode signed message
version uint8 1 bytes
timestamp uint32 4 bytes
pubkey uint8Array 65 bytes
signature uint8Array 65 bytes (as buffer, 88 bytes otherwise)
data uint8Array 74 bytes (fluxapprunning max message size)
total 213 bytes or (187 for app name ipshow) vs 497 when serializing JSON
It wouldn't be too much work to create the serializer / deserializer - then just swap out the JSON serializer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request