[Adding back tmux-users@ to Cc list.  Please don't cull it next time.]

On Sun, Dec 02, 2012 at 05:05:20PM +0400, Peter Vereshagin wrote:
> Hello.
> 
> 2012/12/02 09:18:19 +0000 Thomas Adam <tho...@xteddy.org> => To Peter 
> Vereshagin :
> TA> > tmux-ruby seems to invoke_command(). Is this the only possible way to 
> send a
> TA> > request to tmux-server and receive a response?
> TA> 
> TA> Yes.
> TA> 
> TA> > What I'm expecting is: the 'server and clients' concept sound about a 
> protocol
> TA> > and its spec to me. It's far from always needed to provide a special 
> 'not a
> TA> > data' response to a client, e. g., the file handle of a terminal device.
> TA> 
> TA> No.  The client will use these, but the way you control tmux is through
> TA> using its commands, and have those commands affect which session/client to
> TA> use.
> 
> It seems to be a limitation to me.

No.  You seem to be under the impression that client <-> server
implementation implies some direct communication where everything is
controlled by the server.  But in terms of how tmux operates, the server is
only really responsible for keeping track of client/sessions [1]; the
commands which can run on clients and sessions, are handled by each specific
command which is invoked -- but the communication has already happened with
the server by this point to establish FDs, etc.

So when you run something like:

% tmux lsk

That will call the "list-keys" command entry and run whatever is inside
there.  That such keys are held in RAM by the server doesn't mean that tmux
is querying the server directly via some mythical protocol which you think
might be there *just* because you've heard tmux is client/server based.  No,
rather all that happens is that tmux commands have *access* to such things
directly.  There is no *communication* channel happening via some protocol.

So can you see now, why using tmux directly, and using its commands *is* the
protocol you're after? [2]

> At the very least for the trivial monitoring task I can think of like GUI
> applet watching for amount of seesions and windows in a particular Tmux server
> polling every, say, 3 seconds. Running a polling Tmux command means a much
> resources consumption.

To do what?  When I finish adding in hook support to tmux, this will make
such tasks trivial.

-- Thomas Adam

[1]  I am very much simplifying the explanation here.
[2]  If you've ever heard of "control mode" for tmux, this is a way of being
able to control tmux via output to stdout, which like this "protocol" you're
after.  But it is not finished, and nothing internal to tmux is using it
yet.  There's no guarantee anything in tmux ever will, either.

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to