So I think I am getting crazy.
The problem is that the WebSocket declaration is throwing a SyntaxError only on edge and internet explorer browsers, on other browsers like Chrome and Firefox it works perfectly.
The code that I use:
Connection = new WebSocket("ws:/127.0.0.1:443");
change it to:
var connection = new WebSocket("ws://127.0.0.1:443");