Open jplatte opened 4 years ago
Is your question around why this implementation separates them, or why you'd want to separate them more broadly? The i3 IPC docs say (emphasis added):
Caveat: As soon as you subscribe to an event, it is not guaranteed any longer that the requests to i3 are processed in order. This means, the following situation can happen: You send a GET_WORKSPACES request but you receive a "workspace" event before receiving the reply to GET_WORKSPACES. If your program does not want to cope which such kinds of race conditions (an event based library may not have a problem here), I suggest you create a separate connection to receive events.
Just off the top of my head, it seems like it should be okay to open the connection once, send a bunch of non-event subscription messages, and then subscribing to events and continuing with the program. I have a use case where I want to send messages while receiving events, and it's much more straightforward to just keep a second connection open.
That said, there's probably a way to unify the interfaces such that you can create a single connection, and calling subscribe will start streaming events.
there's probably a way to unify the interfaces such that you can create a single connection, and calling subscribe will start streaming events.
That would be nice.
It seems they both access the same socket file, why are they separate types? Currently, if I want to get the current workspace state at the beginning of my program and then all subscribe to workspace updates, this requires opening the socket file twice.