I have a backend websocket server written in Python. I'm using the websockets package and implementing a secured connection:

context = ssl.create_default_context()
server_corroutine = websockets.serve(self._ui_requests, "localhost", 8765, ssl=context)

On the front end I have a Flutter Web application. I think this complicates things a bit since I cannot use the dart:io package. I'm using a generic implementation package web_socket_channel

_socket = WebSocketChannel.connect(Uri.parse('wss://localhost:8765'));

The answers that I found point to adding

import 'package:universal_io/io.dart'; //using universal implementation since I'm on web

class MyHttpOverrides extends HttpOverrides{
  @override
  HttpClient createHttpClient(SecurityContext? context){
    return super.createHttpClient(context)
      ..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
  }
}

void main() {
  HttpOverrides.global = new MyHttpOverrides();

But this doesn't seem to work... I've been searching for hours and I haven't got any progress.

Can anyone please help me?