triblondon / node-sse-pubsub

Server sent events for NodeJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: RegExp support for event names

GHNewbiee opened this issue · comments

commented

Scenario

There are N real events/activities. On root page there is equal number (N) of open available participations which should be updated.

Solution 1

For the root page, I have only the event 'updateParticipation' with the data being sent are the activity id and its availableParticipations.

Solution 2

For the root page, I have N events update* with single data availableParticipations.

Notes

Events/activities can be created or deleted in real time. In this case:

  • in Solution 1 the data should be handled in that way that each activity component on the root page to get the corresponding availableParticipations.
  • in Solution 2 the array of events should be updated in real time, too, eg ['update1', 'update2',..., 'updateN'], perhaps, through an observable variable of array type.

At first sight, perhaps, Solution 1 is more convinient.

Solution 3

Events are declared by means of a RegExp. In that case, we can have only one subscription with infinite events. When an event is published, first its validity is checked.

What is your opinion? Which solution is faster? Which solution has less overhead cost?

Tia