chromix-too
chromix-too copied to clipboard
is the server necessary?
As far as I understand this, the client and plugin communicate over websockets.
client<->server<->plugin
Is it possible for them to communicate directly without the server?-- or is that just not how websockets work? I was hoping for a solution where I wouldn't have to run a background process(the server).
Looking a bit around the extension I'd say the server is needed, since the extension trys to connect to it, in retry loop until it has one. I.e. if you would try become a websocketserver in a client <-> extension only way, you have to wait for the extension to be connected, until you can send a command into it => You would have to wait 2,3 seconds for each command. Further that current approach is one to many from the server, i.e. you can control many chrome windows from it, each connected as a client.
So I would say its "right" how its done - for most use cases.
Alternative would be to become a websocket server in the extension which looks like possible: https://chrome.google.com/webstore/detail/websocket-server-test/pkbpddppnkjmlbgliipgmhjeialadokj
With that you could control single chrome instances, w/o the need for an extra server outside.
@smblott-github tmux solved this problem as follows, by starting the server in background mode automatically so users don't have to separately keep a tab open with a separate command chromix-too-server running in foreground
see https://github.com/tmux/tmux/wiki/Getting-Started or other resources
tmux keeps all its state in a single main process, called the tmux server. This runs in the background and manages all the programs running inside tmux and keeps track of their output. The tmux server is started automatically when the user runs a tmux command and by default exits when there are no running programs.
Users attach to the tmux server by starting a client. This takes over the terminal where it is run and talks to the server using a socket file in /tmp. Each client runs in one terminal, which may be an X(7) terminal such as xterm(1), the system console, or a terminal inside another program (such as tmux itself). Each client is identified by the name of the outside terminal where it is started, for example /dev/ttypf.