Closed fan2kendrick closed 3 years ago
You're likely trying to use this library in a web application. This library offers two transport types: ipc
and websocket
. Your application must be whitelisted by Discord to use websocket
. Anyone can use ipc
though: that's what you appear to be using.
IPC stands for "inter-process communiation": rather than communicating across a network using HTTP, you're communicating with the Discord client using a shared block of memory. Unfortunately, web applications cannot communicate via IPC (for security reasons).
The reason you're getting o.createConnection is not a function
is because this library is attempting to use Node.js's net
library, which isn't available for web applications. Here's the function the library is trying to call: https://nodejs.org/api/net.html#net_net_createconnection_path_connectlistener
BTW I don't really know what I'm doing as well so I might be partially wrong, sorry :P
Don't worry, and thanks for the answer. But now, if I want to use my app with vue-cli
, I must use websocket
and be whitelisted by Discord ?
Yeah; I'm not too familiar with the process
Using
vue-cli
anddiscord-rpc
, I have this error in the catch of myrpc.login()
. Example code :