Discord’s RPC server supports IPC (Inter-Process Communication) as transport for native applications and games. This allows high-performance, local communication with the Discord client without requiring network-level overhead.
We recommend using the Discord Social SDK for new projects that are looking to integrate Discord’s social features into their game.
IPC Path
Platform
Path Format
Windows
\\?\pipe\discord-ipc-{n}
Linux/macOS
${XDG_RUNTIME_DIR}/discord-ipc-{n}, ${TMPDIR}/discord-ipc-{n}, ${TMP}/discord-ipc-{n}, ${TEMP}/discord-ipc-{n}, or /tmp/discord-ipc-{n}
On Linux/macOS, Discord resolves the IPC prefix in this order: XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP, then /tmp as a final fallback.
Upon success, Discord will respond with a FRAME (Opcode 1) containing the READY event.Once the handshake is complete, all subsequent requests and responses use the FRAME opcode. The internal structure of these frames follows the standard RPC Payload structure
Opcodes
Opcode
Name
Description
0
HANDSHAKE
Sent by the client to initiate the connection
1
FRAME
Used for all standard RPC commands and events
2
CLOSE
Sent by either side to close the connection
3
PING
Sent to check if the connection is alive
4
PONG
Response to a PING
RPC over WebSocket (Deprecated)
This is a deprecated way, which is only available for old participants of private beta. It is preferable to use RPC that uses IPC.
All Discord clients have an RPC server running on localhost that allows control over local Discord clients.
The local RPC server runs on localhost (127.0.0.1) and is set up to process WebSocket connections and proxy API requests.For WebSocket connections, the connection is always ws://127.0.0.1:PORT/?v=VERSION&client_id=CLIENT_ID&encoding=ENCODING:
CLIENT_ID is the client ID of the application accessing the RPC Server.
VERSION is the version of the RPC Server.
PORT is the port of the RPC Server.
ENCODING is the type of encoding for this connection to use. json and etf are supported.
To begin, you’ll need to create an app. Head to your apps and click the big plus button. When you create an app on our Developers site, you must specify an “RPC Origin” and “Redirect URI” from which to permit connections and authorizations. The origin you send when connecting and the redirect uri you send when exchanging an authorization code for an access token must match one of the ones entered on the Developers site.When establishing a WebSocket connection, we verify the Origin header on connection to prevent client ID spoofing. You will be instantly disconnected if the Origin does not match.If you’re connecting to the RPC server from within a browser, RPC origins are usually in the form SCHEME://HOST[:PORT], where SCHEME is typically https or http, HOST is your domain or ip, and PORT is the port of the webserver from which the user will be connecting (omitted for ports 80 and 443). For example, https://discord.com would be used if the user were connecting from https://discord.com/some/page/url.If you’re connecting to the RPC server from within a non-browser application (like a game), you just need to make sure that the origin is sent with the upgrade request when connecting to the WebSocket. For local testing, we recommend testing with an origin like https://localhost. For production apps, we recommend setting the origin to your company/game’s domain, for example https://discord.com.
The port range for Discord’s local RPC server is [6463, 6472]. Since the RPC server runs locally, there’s a chance it might not be able to obtain its preferred port when it tries to bind to one. For this reason, the local RPC server will pick one port out of a range of these 10 ports, trying sequentially until it can bind to one. When implementing your client, you should perform the same sequential checking to find the correct port to connect to.
For connections to the RPC server, a list of approved testers is used to restrict access while you’re still developing. You can invite up to 50 people.For applications/games not approved, we limit you to creating 10 guilds and 10 channels. This limit is raised to virtually unlimited after approval.
The user will then be prompted to authorize your app to access RPC on Discord. The AUTHORIZE command returns a code that you can exchange with a POST to https://discord.com/api/oauth2/token containing the standard OAuth2 body parameters for the token exchange. The token endpoint on our API will return an access_token that can be sent with AUTHENTICATE:
Used to authenticate a new client with your app. By default this pops up a modal in-app that asks the user to authorize access to your app.We currently do not allow access to RPC for unapproved apps without being on the game’s list of testers. We grant 50 testing spots, which should be ample for development. After approval, this restriction is removed and your app will be accessible to anyone.We also have an RPC token system to bypass the user authorization modal. This is usable by approved games as well as by users on a game’s list of testers, and also disallows use of the messages.read scope. If you have been granted access, you can send a POST request to https://discord.com/api/oauth2/token/rpc with your application’s client_id and client_secret in the body (sent as a url-encoded body, not JSON). You can then pass the returned rpc_token value to the rpc_token field in your RPC authorize request (documented below).
set the volume of user (defaults to 100, min 0, max 200)
mute?
boolean
set the mute state of the user
In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app’s configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future.
Used to join and leave voice channels, group dms, or dms. Returns the Get Channel response, null if none.
Select Voice Channel Argument Structure
Field
Type
Description
channel_id
string
channel id to join (or null to leave)
timeout
integer
asynchronously join channel with time to wait before timing out
force
boolean
forces a user to join a voice channel
navigate
boolean
after joining the voice channel, navigate to it in the client
When trying to join the user to a voice channel, you will receive a 5003 error coded response if the user is already in a voice channel. The force parameter should only be specified in response to the case where a user is already in a voice channel and they have approved to be moved by your app to a new voice channel.
In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app’s configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future.
When setting voice settings, all fields are optional. Only passed fields are updated.
Set Voice Settings Argument and Response Structure
Used to subscribe to events. evt of the payload should be set to the event being subscribed to. args of the payload should be set to the args needed for the event.
Used to unsubscribe from events. evt of the payload should be set to the event that was subscribed to. args of the payload should be set to the args needed for the previously subscribed event.
No arguments. Requires the relationships_readOAuth2 scope.Fired when a relationship is added, updated (e.g. presence change), or removed. When a relationship is removed, type will be 0 (NONE).
No arguments. Fired when an entitlement for this application is removed. The entitlement object in the payload reflects the state of the entitlement at the time of deletion.