[keyserver] Avoid "WebSocket is not open" error
Summary:
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.
Test Plan: To be honest, this would be fairly expensive to test compared to the cost of making the diff, and the priority of the issue it's addressing. I think the diff is fairly safe... relying on Flow and CI to catch any issues.
Reviewers: atul, michal, kamil
Reviewed By: atul
Subscribers: tomek, wyilio
Differential Revision: https://phab.comm.dev/D9443