socket.io-client-dart icon indicating copy to clipboard operation
socket.io-client-dart copied to clipboard

Flutter Web update headers not working

Open khenneken opened this issue 3 years ago • 0 comments

I have the problem that I can't change the headers in Flutter Web with the Flutter Map update function. MacOS, iOS & Android works.

  Socket socket = io(
    const String.fromEnvironment(
      'BASE_URL',
    ),
    OptionBuilder()
        .setTransports(['websocket'])
        .setPath('/sockets')
        .setExtraHeaders({
          'authorization': '',
        })
        .setAuth({'authToken': ''})
        .enableReconnection()
        .setReconnectionAttempts(5)
        .build(),
  );

Here is the part that doesn't work in Flutter Web:

  socket.opts!.update(
      'extraHeaders',
      (value) => {
        'authorization': _token,
      },
    );

khenneken avatar Jul 26 '22 11:07 khenneken