Flutter: How to add a header to websockets sink.add

Viewed 480

Hello everyone I use the websocket_channel library for flutter, when I connect I get a live_id, the id is needed for further messages that I will send to the server, I connect to the database in this way:

channel = New IOWebSocketChannel.connection('ws://host.com/',headers: headers);

Let's say that to disconnect I need to send a json body

{ type: 2, id: 1 }

and I also need to pass the live_id in the header, how can I do this?

0 Answers
Related