Linear issue: ENG-5177
This error is not really causing any problems. That said, its appearance can be considered a regression caused by D9298.
Before that diff, the check on this.ws.readyState at the start of sendMessage prevented the error. After that diff, there was a possibility of this.ws.readyState changing after the compression step.
This diff addresses the regression by introducing a second check after the compression step.