preaction / Mercury

A message broker for WebSockets
Other
10 stars 8 forks source link

add SysV semaphores #26

Open preaction opened 8 years ago

preaction commented 8 years ago

SysV semaphores are shared counters. Anyone can increment/decrement them, and everyone gets the result of the increment/decrement. The counter is held and any new member joining the pool gets the same value.

We could also make this hierarchal, like pub/sub.

Use-cases:

Downsides:

preaction commented 8 years ago

They absolutely could not be a hierarchy: When decrementing a parent node, which child node gets it?

Wecould make it so everyone who connects is an "increment", and sends a message to everyone else with the current number of connected clients. Disconnecting decrements the counter (and reports that to other clients).