Websockets connection to echo.websocket.org not starting


The line in question is line 12:
var socket = new WebSocket("wss://echo.websocket.org");
After the socket connects my script is supposed to edit the HTML to say “Connected to (websocket url)” and then log something to the console. However, when I open my console and project preview I see “Connecting…” and nothing in the console. Previously this worked on another web hosting service. What is going wrong?