@discordjs/ws is a powerful wrapper around Discord's gateway.
Node.js 16.11.0 or newer is required.
- zlib-sync for WebSocket data compression and inflation (
npm install zlib-sync)
- bufferutil for a much faster WebSocket connection (
npm install bufferutil)
- utf-8-validate in combination with
bufferutilfor much faster WebSocket processing (
npm install utf-8-validate)
You can also have the shards spawn in worker threads:
Note: By default, this will cause the workers to effectively only be responsible for the WebSocket connection, they simply pass up all the events back to the main process for the manager to emit. If you want to have the workers handle events as well, you can pass in a
workerPath option to the
- Website (source)
- Guide (source) Also see the v13 to v14 Update Guide, which includes updated and removed items from the library.
- discord.js Discord server
- Discord API Discord server
- Related libraries
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official discord.js Server.