Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:Discord RPC

From ReverseEngineering.wiki
Library
Developer Discord
License MIT
Website https://github.com/discord/discord-rpc
On this wiki Facts · Code · Notes · Topics

Discord's local IPC protocol for rich presence (discord-rpc, MIT, deprecated in favour of the closed Discord Game SDK): a game talks JSON over a named pipe or Unix socket called discord-ipc-N using 8-byte framed messages; discord-rpc.dll / libdiscord-rpc.so export Discord_Initialize and friends.

Overview

The library connects to the locally running Discord client, sends a handshake with the application (client) id and then exchanges JSON frames (SET_ACTIVITY, activity join/spectate events). The newer Discord Game SDK (discord_game_sdk.dll, discord_game_sdk.so, exports DiscordCreate) uses the same local IPC to the client but is closed source. The wire format below is from discord-rpc; the IPC framing is shared by both (Unverified for the Game SDK: confirm by watching the pipe).

Identifying it

  • Exports of discord-rpc: Discord_Initialize, Discord_Shutdown, Discord_RunCallbacks, Discord_UpdateConnection, Discord_UpdatePresence, Discord_ClearPresence, Discord_Respond, Discord_UpdateHandlers. Game SDK: the single export DiscordCreate.
  • Strings: \\.\pipe\discord-ipc-0 style name (the code literal is \\?\pipe\discord-ipc-0 with the prefix \\?\pipe\) (Windows), %s/discord-ipc-%d under XDG_RUNTIME_DIR or TMPDIR (Unix), JSON keys cmd, evt, client_id, values SET_ACTIVITY, DISPATCH, READY, ACTIVITY_JOIN, ACTIVITY_JOIN_REQUEST.
  • The application id is a Discord snowflake string passed to the handshake; it is not a secret.

Wire format

See the facts on this page.

Code & repositories

Related

Library:Steamworks API, Library:Epic Online Services SDK.