Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
Making a Discord rich presence browser extension using node.js and Browserify and i have trouble with Websockets

Soo basically i made a Discord rich presence extension for when im on a specific site and I noticed i cant use node.js for it but if I use browserify I can work around that with a bundled script. The problem is that i get WebSocketTransport errors and i don't know how to solve those. I have little experience with programming and i mostly create discord bots. I am using discord-rpc node module because i have experience with it and Im only getting errors when i use the discord-rpc module.

Error:

bundle.js:3177 Uncaught (in promise) Error: connection closed
    at WebSocketTransport.<anonymous> (bundle.js:3177:16)
    at Object.onceWrapper (bundle.js:2179:26)
    at WebSocketTransport.emit (bundle.js:2089:5)
    at WebSocketTransport.onClose (bundle.js:4147:10)

bundle.js:3166 Uncaught (in promise) Error: RPC_CONNECTION_TIMEOUT
    at bundle.js:3166:47

The way i defined the module:

const clientId = '865555817466298408';
const RPC = require('discord-rpc');
const scopes = ['rpc', 'rpc.api', 'messages.read'];
const client = new RPC.Client({ transport: 'websocket' });

The Location of the error:

async connect() {
    const port = 6463 + (this.tries % 10);
    this.tries += 1;

    this.ws = new WebSocket(
      `ws://127.0.0.1:${port}/?v=1&client_id=${this.client.clientId}`,
      browser ? undefined : { origin: this.client.options.origin },
    );
    this.ws.onopen = this.onOpen.bind(this);
    this.ws.onclose = this.onClose.bind(this);
    this.ws.onerror = this.onError.bind(this);
    this.ws.onmessage = this.onMessage.bind(this);
  }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda