Skip to content

Commit

Permalink
feat(VoiceConnection): lower browser runtime error to a warning
Browse files Browse the repository at this point in the history
The base work around "browser" support was done over 7 years ago.
Although nothing much has changed when it comes to supporting UDP
connections in browsers, over time, browser-like runtimes like Deno,
Bun, and others claiming (partial) Node compatibility (including UDP
connections) have emerged. Although using Dysnomia with these browser-
-like environments won't be officially supported, I think that rather
than blocking them outright, we should acknowledge that those alternative
runtimes exist and allow them to try to use voice at their own risk with
a warning that they might possibly end up seeing undefined or weird
behavior.
  • Loading branch information
TTtie committed Sep 12, 2023
1 parent 448f40b commit be9a700
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/voice/VoiceConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class VoiceConnection extends EventEmitter {
super();

if(typeof window !== "undefined") {
throw new Error("Voice is not supported in browsers at this time");
process.emitWarning("Voice is not supported in browser-like runtimes. Proceed at your own caution.", "BrowserLikeRuntimeWarning", "dysnomia:VOICE_BROWSER");
}

if(!Sodium && !NaCl) {
Expand Down

0 comments on commit be9a700

Please sign in to comment.