[Y-devel] server side messages
Thomas spiralman at softhome.net
Wed Feb 25 22:34:57 GMT 2004
I have implemented some basic server side messages in the form of registering
a function pointer with an object, and the object checking to see if the
pointer is NULL in objectEmitSignal, if it is, it calls the function,
otherwise it emits the signal as normal.
however, it might be nice for multiple clients and multiple bits of the server
to be able to register as listeners of the same object (the desktop, for
instance). On the client side, this would simply be adding a list of clients
registered with the object (instead of the single client it has now) and
iterating through that list, dispatching the same message to all of them.
The client library would have to be changed to ensure that they all
unregister themselves from the object as well (it is currently assumed that
when a client goes away, the object it was listening to goes away with it)
On the server, this could be implemented with a list of function pointers.
However, this brings up the fact that Mark wrote the Object code assuming only
one client would be listening to it. Currently, a client "subscribes" to an
object's signals, which means the object maintains a list of signals that the
client is interested in, and only sends a signal if its client has subscribed
to it.
This breaks down when multiple clients are allowed to listen to a single
object. When either a client or the server subscribes to a signal, all the
clients listening to that object will receive that signal. this could be
fixed as far as clients go by storing the subscribed to signals in the Client
object, and having Object make sure that each client it is iterating over
only gets signals it has requested. While there is a slight amount of
overhead added to this additional check, it seems negligible compared to the
overhead of sending unwanted signals over the network (that depends, of
course, on whether clients will be listening to drastically different signals
or not).
On the server side, however, this might be too much overhead, as the function
call overhead is minimal, and the functions that have been sent to the object
can always check to see if they need to deal with the message or not (they
already have to check the type to see what to do about it).
anyway, i was just wondering what people's thoughts on the subject were, and
if anybody has any better solutions.
Thomas Stephens
spiralman at softhome.net
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved