pub fn subscribe_method(host: Arc<WorkspaceHost>, router: Router) -> RouterExpand description
Add workspace.subscribe to router.
The method subscribes the client to the host’s events — the current workspace’s, and
after a switch the next one’s (#215) — and spawns a task that forwards each event to
that client as a workspace.event notification, naming the root it came from. The task
stops when the client disconnects — PeerHandle::notify fails once the connection is
gone — so a client that comes and goes does not leak tasks.
Subscribing twice from the same connection still acknowledges, but starts no second pump, so a client cannot double its own event stream. Subscribing needs no workspace: a client may subscribe before the first one is selected.
A subscriber that falls more than the event capacity (128) behind loses the events in between and gets a warning in the server log: treat an event as “something happened, re-read”, not as the change itself.