I work with IOWebSocketChannel and I don't have access to Webscoket inside it
in order to change the user-agent. how can I achieve that and set user agent for IOWebSocketChannel?
I work with IOWebSocketChannel and I don't have access to Webscoket inside it
in order to change the user-agent. how can I achieve that and set user agent for IOWebSocketChannel?
according to this issue: Add option to set User Agent for Websocket #32008 and the documentation: WebSocket
you can't set user agent for IOWebSocketChannel but you can just set userAgent for all Websocket instance by call:
Websocket.userAgent = 'your desired agent';
this works for all Websocket instance, so there is no need to access the websocket instance object passed to IOWebSocketChannel.
If you are creating the socket using IOWebSocketChannel.connect you can just add the user-agent in the headers parameter, or otherwise if you are upgrading to a IOWebSocketChannel from a WebSocket (with WebSocket.connect) set your headers there.