If on Linux/Mac OS Discord
# example commands
sudo mv $XDG_RUNTIME_DIR/discord-ipc-0 ./discord-ipc-0 # backup original socket
sudo socat -t100 -x -v UNIX-LISTEN:$XDG_RUNTIME_DIR/discord-ipc-0,mode=777,reuseaddr,fork UNIX-CONNECT:$(pwd)/discord-ipc-0
socat opens a bidirectional tunnel that will forward message to and from these two sockets.
-v
will print debug message to stdout, allowing you to read the raw hex data traffic
- The application sends an init message:
'\x00\x00\x00\x00(\x00\x00\x00{"v":1,"client_id":"504587825122456329"}'
- 8 byte header for padding?
- Sends the client ID
- Discord client RPC sends a response:
....F...{"cmd":"DISPATCH",
"data":{"v":1,"config":{"cdn_host":"cdn.discordapp.com","api_endpoint":"//discord.com/api","environment":"production"},
"user":{"id":"[USER ID]","username":"[USERNAME]","discriminator":"[USER DISCRIMINATOR]","avatar":"[AVATAR HASH]","bot":false,"flags":xxx,"premium_type":x
}},"evt":"READY","nonce":null}
- again with an 8 byte header
- Application sends rich presence payloads:
........{"cmd":"SET_ACTIVITY",
"args": {"pid":22371, "activity": {
"state": "Test",
"details": "Test details",
"instance":true}}, "nonce":"1643825703.14191587033350390625"}