From 36e7d5d3a20442a05ea2185f42f4426514f818b1 Mon Sep 17 00:00:00 2001 From: Jumper Chen Date: Fri, 5 Jun 2020 10:53:36 +0800 Subject: [PATCH] add Troubleshooting section for #84 and #95 --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index bf15a28..9626f9b 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,28 @@ IO.Socket socket = IO.io('http://localhost:3000', { }); ``` +## Troubleshooting + +### Cannot connect "https" server or self-signed certificate server +* Refer to https://github.com/dart-lang/sdk/issues/34284 issue. +The workround is to use the following code provided by @lehno on #84 +``` +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(); + runApp(MyApp()); +} +``` + + ## Notes to Contributors ### Fork socket.io-client-dart