
The ':monitor:' capability allows an NSM client to get informations from the NSM server about other clients in the session.

To become a monitor client, the client MUST check if the NSM server has the ':monitor:' capability, and its capability string MUST contain ':monitor:'.

Just before receiving the first /nsm/client/open message, the monitor client will receive for each client in the session the following status message:

/nsm/client/monitor/client_state s:client_id s:jack_client_name i:is_started

'is_started' is 1 if the client is started or 0 if the client is stopped.

when all client are listed, server sends
/nsm/client/monitor/client_state s:empty_str s:empty_str i:number_of_clients
where empty_str is '', number_of_clients is the number_of_clients monitored, 
it does not count this monitor client.

If a monitor client is capable of ':switch:', the same client_state list will be received at session change.

No 'client_state' message will be received if its started state change.

A monitor client can query the state of the other clients at any time by sending this message to the server

/nsm/server/monitor_reset


At each client event, this monitor client will receive :

/nsm/client/monitor/client_event s:client_id s:event

where 'event' can be

started
joined
ready
saved
stopped_by_server
stopped_by_itself
switched_to:new_client_id
id_changed_to:new_client_id
removed
open_error
save_error
start_request
save_request
stop_request

the 'joined' event happens when a client is started from the outside, for example when it is started from the shell with the command `NSM_URL=server_url executable`.

the 'switched_to:new_client_id' event happens when client switches. "new_client_id" is replaced with the new client id of course. The client is still running but its client_id and others properties have been changed. 

in RaySession, the 'removed' event happens when a client is definitely removed from the trash.

Note that a monitor client does not receives /nsm/client/monitor_event if the event
concerns this monitor client.


-------------------------------------

In RaySession, there is also the possibility for an external program to become a monitor.
This allows to get informations on the session clients and be warned of clients events without being a session client.
The program becomes a ray-daemon monitor with:

/ray/server/monitor_announce

it MUST send to server the following message before to be stopped:

/ray/server/monitor_quit


It will receives the same messages than a monitor client, but for logical reasons,
'/nsm/client/monitor/' is substitued with '/ray/monitor/' in paths.

it receives client states and events at 
/ray/monitor/client_state s:client_id i:is_started
/ray/monitor/client_event s:client_id s:event
