How can I set user-agent in 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.

Answered By – feedpanda

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *