[eq-dev] Sending events to all clients

Stefan Eilemann eilemann at gmail.com
Tue Sep 1 12:08:47 CEST 2009


On 26. Aug 2009, at 16:39, Mathias Heyer wrote:

> as far as I know, the event-mechanism is able to forward render  
> client-local events to the application node.
> Is there a similar way to send events from the application node to  
> (all) the render clients?

Other than the solution described by Dan, no. We've been planning to  
refactor the event system using a generic consumer/producer model for  
some time, but nobody found the time to do it yet. These are my  
thoughts so far:

Revamp Event Handling

Producer/Subscriber model

new: void Config::selectEvent( Event::Type type, net::NodeID node =  
Node::ALL );
                   clearEvent( ... );

void Config::sendEvent( ConfigEvent event );
-> old: Sends event to appNode
-> new: Sends event to all subscribers
         o appNode has default subscription to all events


Server subscribes to events for load-balancing
   old: Channel::frameFinish sends all channel statistics in one batch
   new: Channel select events if at least one listener is registered
        Config (instead of channel) receives
        at the end of each frame
            for each channel
                gather all events for channel
                Channel::fireLoadData


                              Implementation

Each config instance has its own event mask for each subcriber
   NodeID -> events

selectEvent( Event::Type type, net::NodeID node = Node::ALL );
(clearEvent)
   if all nodes
      send select packet to master
   else
      connect node
      send select packet to node

_cmdSelectEvent()
(_cmdClearEvent)
   if all nodes
      assert is session master
      for each node of session
          send select packet to node
      update own event list
   else
      update own event list
         if no events left for subscriber, remove from map

void Config::sendEvent( ConfigEvent event )
   for each subscriber
       if event is selected
            connect node
            send event packet


Add tracking of nodes on session master:
   during Node::_cmdMapSession, add slave nodes
   during Node::_cmdUnmapSession, remove slave nodes


Cheers,

Stefan.




More information about the eq-dev mailing list