metroplex
metroplex copied to clipboard
questions
Hi,
-
Are spark IDs always unique?
-
What would be the most efficient way to associate additional information with each spark ID? So, even if sparks are disconnected and reconnected, we could transfer the associated info to new spark IDs.
-
Can we easily make it check current server for spark IDs etc (ref: .sparks())?
-
Does forward.sparks() also include current/local server for sending messages?
Thanks.
- Spark id's are connection id's while they are unique they only live as long as the actual connection is alive. So when you get a reconnect the spark.id will be gone. If you want to have more persistent id's you can look at our mirage project.
- Probably just store data in an auto expiring database/cache like redis based on the connection or mirage id.
- In primus you can just use the
primus.forEach
method to iterate over all sparks that are connected that your primus server, this does not include the one's that are in a metroplex cluster. - Yes, it checks and sends to local server before broadcasting it to the other connected servers.
Does metroplex emit event(s) when spark and/or server is disconnected/removed from registry?