Skip to main content

instance_id

Function instance_id 

Source
pub fn instance_id() -> &'static str
Expand description

This process’s share of a socket identity.

A SocketId is a counter, so replica A and replica B both have a socket 7. That is fine while the only thing reading the number is the process that issued it, and wrong the moment a broadcast crosses between them: “do not send this to socket 7” would silence a different browser on every other replica.

So Socket::identity pairs the counter with this, which is generated once per process from the clock. Two processes agreeing on it would need to have started in the same microsecond.