make sure to use WebSocket with an uppercase "S" and instantiate it with new. Check if window.opener.WebSocket is accessible and use:
const websocket = new window.opener.WebSocket('ws://address');
If it still doesn’t work, verify the context and permissions between windows.