Is it possible to use WebSockets in Thunderbird addons?

I tried to put the following code — which works properly in Firefox — in background.js without success:

console.log("a");

let ws = new WebSocket("wss://echo.websocket.org");

console.log("b");

I only get this result in the debugging console:

Webconsole context has changed
a background.js:1:9
Webconsole context has changed
: background.js:3
moz-extension://e908747f-c410-4427-8868-1336f813f1cd/background.js:3

Does anyone has an idea on how to make WebSockets work?

It was a bug in Thunderbird.
WebSockets are actually being fixed by Thunderbird developpers.

You can follow it here: https://bugzilla.mozilla.org/show_bug.cgi?id=1627649