During the development process, on my localhost I used the ws:/ip:1234 and everything worked properly.
this.provider = new WebsocketProvider( 'ws:/xx.xxx.xxx.xxx:1234/', 'document.' + this.hash, this.ydoc, )
However, once I changed it to ws:/domain.com:1234 connection refused to be established. Same with wss:/domain.com:1234. The reason ws:/ip:1234 is not applicable for me is that my website is running on HTTPS and cannot establish ws:/ connections. This should be the case for many users.
I googled and came upon a solution that involved nginx configuration, however still was not able to implement it, due to the lack of knowledge in this field.
Posting it here, so that once the solution is found - everyone can benefit from it.