-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how can i add headers in Web socket channel in flutter web #379
Comments
|
i think you misunderstood i am saying IOWebSocketChannel does not supports on flutter web so i have to use WebSocketChannel and it does not provide headers options import 'package:web_socket_channel/web_socket_channel.dart'; |
Is that I did not read the question carefully enough, I do not know how to solve your problem, I do not have time to explore the problem, looking forward to the answer |
Use this: import 'package:web_socket_channel/io.dart';
_channel = IOWebSocketChannel.connect(
url,
headers: {
'Authorization': 'Bearer $apiKey',
},
); |
Ins't supported by web platform |
You are right!. Sorry. Use this package it's working for me: final isTextSocketConnected = await socketHandler.connect(
params: SocketOptionalParams(
headers: {
'Authorization': 'Bearer $apiKey',
},
));
|
|
web_socket_channel don't have support to web, use websocket_universal, it is working on Android, iOS, Web. websocket_universal: ^1.2.5 |
Guys, headers work ONLY for IO (that is mobile devices for example). For web you MUST pass header in one of two ways:
|
in mobile app we can use IoWebSocketChannel but its not supported in Flutter web ,
but I am unable to add Headers in WebsocketChannel , can anyone provide a solution
like we use in IO
The text was updated successfully, but these errors were encountered: