A method and apparatus are provided for handling events received at a media streaming
server. Server sockets configured to receive events are divided into collections
and registered with a polling object. Each collection shares a processor thread
for detecting events. Each socket is associated with an event consumer object that
is notified when an event is received at the socket. The event consumer objects
invoke task objects to handle the events. Task objects are queued in a task queue
and execute using a pool of processor threads. Event consumer objects are derived
from an abstract base consumer class that defines a common interface. Subclasses
of the base consumer class are configured for different types of events that may
be received (e.g., connection requests, media streaming commands, media data, media
stream quality reports). Specific event consumer objects are instantiated from
the subclasses to provide implementations of the common interface.