Open princesoni18 opened 3 months ago
final headers = {
'cos': cos, // device_type: iso android macos web
'vsn': appVsn,
'pkg': packageName,
'did': deviceId,
'tz_offset': DateTime.now().timeZoneOffset.inMilliseconds,
'method': 'sha512',
// signKeyVsn 告知服务端用哪个签名key 不同设备类型签名不一样
'sk': globalSignKeyVsn,
'sign': EncrypterService.sha512("$deviceId|$appVsn|$cos|$packageName", key)
};
....
_wsChannel = IOWebSocketChannel.connect(
url!,
headers: headers,
pingInterval: Duration(milliseconds: _heartTimes),
protocols: protocols,
);
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'; webSocketChannel = WebSocketChannel.connect( {Uri } );
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'; webSocketChannel = WebSocketChannel.connect( {Uri } );
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
import 'package:web_socket_channel/io.dart';
_channel = IOWebSocketChannel.connect(
url,
headers: {
'Authorization': 'Bearer $apiKey',
},
);
Use this:
import 'package:web_socket_channel/io.dart'; _channel = IOWebSocketChannel.connect( url, headers: { 'Authorization': 'Bearer $apiKey', }, );
Ins't supported by web platform
Ins't supported by web platform
You are right!. Sorry.
Use this package it's working for me: https://pub.dev/packages?q=websocket_universal
final isTextSocketConnected = await socketHandler.connect(
params: SocketOptionalParams(
headers: {
'Authorization': 'Bearer $apiKey',
},
));
Ins't supported by web platform
You are right!. Sorry.
Use this package it's working for me: https://pub.dev/packages?q=websocket_universal
final isTextSocketConnected = await socketHandler.connect( params: SocketOptionalParams( headers: { 'Authorization': 'Bearer $apiKey', }, ));
Ins't supported by web platform
You are right!. Sorry. Use this package it's working for me: https://pub.dev/packages?q=websocket_universal
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
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