feat: Unix socket IPC for send while sync is running#20
Open
sergi039 wants to merge 2 commits intosteipete:mainfrom
Open
feat: Unix socket IPC for send while sync is running#20sergi039 wants to merge 2 commits intosteipete:mainfrom
sergi039 wants to merge 2 commits intosteipete:mainfrom
Conversation
Problem: wacli send cannot work while sync --follow is running because both commands need an exclusive lock on the store directory. Solution: sync --follow now starts a Unix socket server that accepts send commands from other wacli processes. Changes: - internal/ipc/ipc.go: New IPC server/client using Unix sockets - cmd/wacli/sync.go: Start IPC server in --follow mode (--enable-ipc=true by default) - cmd/wacli/send.go: Try IPC first, fallback to direct if unavailable Usage: Terminal 1: wacli sync --follow Terminal 2: wacli send text --to 1234567890 --message 'Hello!' The send command will detect the running sync daemon and route the message through the IPC socket instead of trying to acquire the lock. Flags: sync --enable-ipc=false # disable IPC server send --no-ipc # skip IPC, use direct mode only Tested: Successfully sent messages via IPC while sync was running.
Adds wacli delete message command to revoke/delete sent messages. Changes: - cmd/wacli/delete.go: New delete command with IPC support - internal/wa/client.go: Add RevokeMessage and OwnJID methods - internal/ipc/ipc.go: Add delete_message IPC command - cmd/wacli/sync.go: Add DeleteMessage handler Usage: wacli delete message --chat 1234567890@s.whatsapp.net --id <msg-id> Also supports IPC when sync daemon is running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wacli sendcannot work whilesync --followis running because both commands need an exclusive lock on the store directory. This makes it impossible to send messages programmatically while maintaining a sync session.Solution
sync --follownow starts a Unix socket server that accepts send commands from other wacli processes.How it works:
sync --followstarts an IPC server at~/.wacli/wacli.socksendchecks if the socket exists and tries IPC firstChanges
internal/ipc/ipc.go: New IPC server/client using Unix socketscmd/wacli/sync.go: Start IPC server in--followmode (--enable-ipc=trueby default)cmd/wacli/send.go: Try IPC first, fallback to direct if unavailableUsage
New Flags
sync --enable-ipc=false- disable IPC serversend --no-ipc- skip IPC, use direct mode onlyTesting
Successfully tested sending messages via IPC while sync was running.