@hacksore/discord-rpc
Advanced tools
Comparing version 5.0.0-alpha1 to 5.0.0-beta1
{ | ||
"name": "@hacksore/discord-rpc", | ||
"version": "5.0.0-alpha1", | ||
"version": "5.0.0-beta1", | ||
"description": "A simple RPC client for Discord", | ||
@@ -28,3 +28,2 @@ "keywords": [ | ||
"devDependencies": { | ||
"electron": "^7.1.9", | ||
"webpack": "^4.40.0", | ||
@@ -31,0 +30,0 @@ "webpack-cli": "^3.3.8" |
@@ -0,0 +0,0 @@ <div align="center"> |
@@ -103,9 +103,3 @@ const EventEmitter = require("events"); | ||
this.clientId = clientId; | ||
const timeout = setTimeout( | ||
() => reject(new Error("RPC_CONNECTION_TIMEOUT")), | ||
10e3 | ||
); | ||
timeout.unref(); | ||
this.once("connected", () => { | ||
clearTimeout(timeout); | ||
resolve(this); | ||
@@ -120,2 +114,3 @@ }); | ||
}); | ||
this.transport.connect().catch(reject); | ||
@@ -122,0 +117,0 @@ }); |
@@ -0,0 +0,0 @@ function keyMirror(arr) { |
@@ -0,0 +0,0 @@ const util = require("./util"); |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -16,3 +16,5 @@ const net = require("net"); | ||
if (process.platform === "win32") { | ||
return `\\\\?\\pipe\\discord-ipc-${id}`; | ||
const socketPath = `\\\\?\\pipe\\discord-ipc-${id}`; | ||
console.log(`Found winderz socket @ ${socketPath}`) | ||
return socketPath; | ||
} | ||
@@ -23,3 +25,5 @@ const { | ||
const prefix = XDG_RUNTIME_DIR || TMPDIR || TMP || TEMP || "/tmp"; | ||
return `${prefix.replace(/\/$/, "")}/discord-ipc-${id}`; | ||
const socketPath = `${prefix.replace(/\/$/, "")}/discord-ipc-${id}`; | ||
console.log(`Found *nix socket @ ${socketPath}`) | ||
return socketPath; | ||
} | ||
@@ -159,6 +163,13 @@ | ||
send(data, op = OPCodes.FRAME) { | ||
this.socket.write(encode(op, data)); | ||
if (!this.socket) { | ||
return; | ||
} | ||
this.socket.write(encode(op, data)); | ||
} | ||
async close() { | ||
if (!this.socket) { | ||
return; | ||
} | ||
return new Promise((r) => { | ||
@@ -172,2 +183,6 @@ this.once("close", r); | ||
ping() { | ||
if (!this.socket) { | ||
return; | ||
} | ||
this.send(uuid(), OPCodes.PING); | ||
@@ -174,0 +189,0 @@ } |
@@ -0,0 +0,0 @@ const EventEmitter = require("events"); |
2
1088
32800