JSFiddle - React, Tailwind, and code Playground

JavaScript

host='localhost';
port=100;
try {
    
    ws = new WebSocket('ws://'+ host + ':' + port + '/');
  }
  catch (err) {
    console.log('This never prints');
  }
  ws.onerror = function (error) {
    console.log(error);
  };