How to fix error: WebSocket is already in CLOSING or CLOSED state

Some errors you can see:

Example 1:

Example 2:

Example 3:

How to fix this error?

If you use, use version 2.0.3

npm i

If you use ws, use version from 0.4.25 to 0.4.32

npm i ws@0.4.32

You can try with other versions.

Leave a Reply