WL#396: Enhance client protocol to allow notifications.

Status: Un-Assigned   —   Priority: Medium

Currently all information client gets from server is initiated by client. So  
if client would need to wait for some event it will have to poll server in a  
loop which produces extra load and requires special programming techniques to  
So it would be good to add to client server protocol notifications of a 
different sort - so client would register it is waiting some event and it will  
get notofication from server as soon as it happens. Also some events may be  
sent as notifications to all of the clients, for example if server will go  
down shortly. 
This for example may be used to get rid of special application server for some  
if interactive applications.  Let's say application is displaying the list of  
records to the client and would like to have it actual - so if some records  
arrive they are added to the list automatically as well as removed if they are  
deleted.  Currently you will have to use application server to maintain such  
list or poll MySQL server in a loop which would require extra connection and  
produce overhead. 
There are  two options for implementing this - blocking. Then you are waiting  
for event by issuing  LISTEN <event> query  which will complete as soon as  
event happens  and  non blocking. Then client just register function which  
should be called in case event happens, and client may be informed about this  
event in any time (similar to signals).  Events may be raised internally by  
some of system operations, or executed by other/users/triggers/stored  
procedures by getting use of special statement. Ie NOTIFY <event>