Socket client connect

I’m trying to make a remote connection to my smart TV via socket.
initially I started with nodejs to test.
I used the ws library and made the connection successfully, and obtained the token:

new WebSocket('wss://', { rejectUnauthorized: false });

So I did the same strategy in Angular. I tested with:, ngx-socket-io and isomorphic-ws.
And I get the same error in all libraries: ERR_CERT_AUTHORITY_INVALID and Failed to construct ‘WebSocket’: The subprotocol ‘[object Object]’ is invalid.
when I pass the parameter

{ rejectUnauthorized: false }

Would there be any solution to make it work on the client side?