WS connection error

Hi. The project worked for more than a year, but now it has crashed and does not start.

I receive that error:

WS connection error _Event {
  type: 'error',
  isTrusted: false,
  _yaeti: true,
   W3CWebSocket {
     _listeners: {},
     addEventListener: [Function: _addEventListener],
     removeEventListener: [Function: _removeEventListener],
     dispatchEvent: [Function: _dispatchEvent],
     _url: 'wss://',
     _readyState: 3,
     _protocol: undefined,
     _extensions: '',
     _bufferedAmount: 0,
     _binaryType: 'arraybuffer',
     _connection: undefined,
      WebSocketClient {
        domain: null,
        _events: {},
        _eventsCount: 0,
        _maxListeners: undefined,
        config: [Object],
        _req: null,
        protocols: [],
        origin: undefined,
        url: [Object],
        secure: true,
        base64nonce: 'Q+yRwcfNXmQpK0NzlpTrxg==' },
     onerror: [Function],
     onclose: [Function],
     onmessage: [Function],
     onopen: [Function] },
  cancelable: true,
  stopImmediatePropagation: [Function] }

I made simple example with error:

  "name": "",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "dependencies": {
    "web3": "^1.2.6"
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC"

const Web3 = require('web3');

let provider = new Web3.providers.WebsocketProvider("wss://");
let web3 = new Web3(provider);

provider.on('error', e => {
    console.error('WS connection error', e);
    console.log('Manual process exit');


provider.on('close', e => {
    console.error('WS connection close', e);
    console.log('Manual process exit');


provider.on('end', e => {
    console.log('WS connection end', e);
    console.log('Manual process exit');

provider.on('connect', () => {
    setInterval(async() => {
        console.log(await web3.eth.getBlockNumber());
    }, 10000);

What’s wrong?

Hi @Steelclad and welcome to our community site.

For your project, we now enforce the use of a valid Project ID when connecting. The endpoint will look like this: wss://

To create a Project ID, you can login to the Dashboard and generate a new project, once you’ve done that your Project ID can be used in that URL and you should be all set.

Hope this helps!

Nice! It works. Thanks