nknorg / nkn-protocols

Documentation and discussion of NKN protocols, including NKN node and NKN client
2 stars 1 forks source link

Holding seconds #5

Open RealJohnSmith opened 5 years ago

RealJohnSmith commented 5 years ago

Can anyone explain how exactly field max_holding_seconds work in ClientToNode message?

yilunzhang commented 5 years ago

When would you want to use it (from client/app developer perspective)

You want to use it if msg sent to client should be hold by node if the receiver is not online. But this is not reliable since it's only hold by one node.

What happens on node/network side

When the msg reaches the node that should be connected to the client (if online) and found the client not connected, he will put the msg in a buffer. When a client get online, msg in the buffer will be sent to the client.

Is there maximum value (or some max safe value)? Can I hold a message for a year?

Currently no but we should probably have one.

How do ACKs work when combined with message holding. Should this holding be taken into account before ACK timeout?

ACK and msg holding are completely independent. ACK is client protocol and node has no idea about it. Holding is node protocol. If msg is hold, client side will not get any ACK because client is not online of course.

Do values like 0 or -1 or any other have special meaning?

0 means do not hold. -1 is invalid because the type is uint32.

PS: currently it has not been fully implemented, and any nonzero value will cause the msg to be holding until node restart. Zero value works as intended and msg will not be hold.