I have an issue to connect to WS in different domain with angular. The ws is ok, I can connect to it via postman:
The url looks like this: {{hosturlws}}/ws?station=1f51228c-25ae-47c0-965f-68025268e2a2
The host urlws is: wss://{{ourDomain}}
I can see the data in postman,
If I’M trying to connect in Angular I got error.
This is my socket: this.socket = new WebSocket(‘ws?station=’ + stationId);
This is my proxy config for it:
“/ws”: {
“target”: “wss://{{ourDomain}}”,
“secure”: false,
“ws”:true,
“logLevel”: “debug”
},
But I get this in console:
socket.service.ts:16 WebSocket connection to ‘ws://localhost:4200/ws?station=1f51228c-25ae-47c0-965f-68025268e2a2’ failed:
Do you have any advice?
Regards,
Ben
I want to connect to ws in angular
Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.