Closed Waujito closed 3 years ago
And whats the related code?
Things to consider when getting a connection closed/could not connect error: • What transport are you using? If it's 'websocket', change that to 'ipc' • Is the ID you are trying to login with your user ID? If so, get one from the developer portal instead • Are you using the Discord app? It won't be able to connect to the web version • Is your code running on the same machine as the Discord app? • Are you trying to run it from WSL? If so, it won't be able to connect either • Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website
And whats the related code?
Things to consider when getting a connection closed/could not connect error: • What transport are you using? If it's 'websocket', change that to 'ipc' • Is the ID you are trying to login with your user ID? If so, get one from the developer portal instead • Are you using the Discord app? It won't be able to connect to the web version • Is your code running on the same machine as the Discord app? • Are you trying to run it from WSL? If so, it won't be able to connect either • Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website
it is example
i tryed websocket and ipc. my code doesnt work too:
const clientId = 'xxx';
const RPC = require('discord-rpc');
const client = new RPC.Client({ transport: 'ipc' });
client.on('ready', () => {
console.log("Ready");
});
// Log in to RPC with client id
client.login(clientId, {clientSecret: "xxx"});```
i tryed websocket and ipc. my code doesnt work too:
const clientId = 'xxx'; const RPC = require('discord-rpc'); const client = new RPC.Client({ transport: 'ipc' }); client.on('ready', () => { console.log("Ready"); }); // Log in to RPC with client id client.login(clientId, {clientSecret: "xxx"});```
clientid is id of my application
im sorry. it works! i used client.login(clientId, {clientSecret: "xxx"}). i try use client.login({clientId:client_id}); and it works
i cant use discord-rpc module. example doesnt work too(( error: connection closed. ipc and websocket. help me plz