https://github.com/dart-lang/web_socket_channel/issues/38

yes, my workaround is to create a WebSocket directly. Something like:

      final socket = await WebSocket
.connect(url.toString())
.timeout(_webSocketConnectionTimeout);
return IOWebSocketChannel(socket);

Then I wrap this in a try-catch, so I can catch SocketException and TimeoutException and handle these in a way that makes sense for my app.

the following way works for me:

      stream = widget.webSocketChannel.stream;
streamSubscription = stream.listen(
onData,
onError: (error) {
// method calls and what not here
},
cancelOnError: true);
}

I don't know if it is working because I have a StreamSubscription or whether it simply is an additional step.

IOWebSocketChannel.connect handle errors的更多相关文章

  1. [ES7] Handle Errors in Asynchronous Functions

    This lesson shows how regular control flow statements such as try/catch blocks can be used to proper ...

  2. [Ramda] Handle Errors in Ramda Pipelines with tryCatch

    Handling your logic with composable functions makes your code declarative, leading to code that's ea ...

  3. [Vue @Component] Handle Errors and Loading with Vue Async Components

    Because async components are not bundled with your app, they need to be loaded when requested. This ...

  4. 理解ASP.NET Core - 错误处理(Handle Errors)

    注:本文隶属于<理解ASP.NET Core>系列文章,请查看置顶博客或[点击此处查看全文目录](https://www.cnblogs.com/xiaoxiaotank/p/151852 ...

  5. [React] Handle React Suspense Errors with an Error Boundary

    Error Boundaries are the way you handle errors with React, and Suspense embraces this completely. Le ...

  6. Exceptions and Errors on iOS

    异常:程序缺陷导致:不可恢复:给开发者使用: 错误:资源受限导致:可恢复:提示给用户. https://blog.jayway.com/2010/10/13/exceptions-and-errors ...

  7. Laravel API Errors and Exceptions: How to Return Responses

    Laravel API Errors and Exceptions: How to Return Responses February 13, 2019 API-based projects are ...

  8. squid源码安装下的conf文件默认值和提示

    #    WELCOME TO SQUID 3.0.STABLE26#    ----------------------------##    This is the default Squid c ...

  9. Node.js高级编程读书笔记 - 4 构建Web应用程序

    Outline 5 构建Web应用程序 5.1 构建和使用HTTP中间件 5.2 用Express.js创建Web应用程序 5.3 使用Socket.IO创建通用的实时Web应用程序 5 构建Web应 ...

随机推荐

  1. Hyper-V中安装CentOS7设置静态ip并且可以连接外网

    https://blog.csdn.net/xj19940904/article/details/89165002 https://blog.csdn.net/u011598235/article/d ...

  2. linux 下nc 命令的使用

    linux 下nc 命令的使用 https://blog.51cto.com/samyubw/555247

  3. [oracle/java/sql]用于上十万批量数据插入Oracle表的Java程序

    程序下载:https://files.cnblogs.com/files/xiandedanteng/LeftInnerNotExist20191222.rar 原理:Oracle的Insert al ...

  4. ipa重签名最直接的教程

    ipa 包重签名最新最简单教程 重签名的意义:ipa 重签名最大的用处是,不必重新打包,和配置其它第三方获取 appkey 等操作,直接重签名之后依然可以拥有这些功能,更快的发布测试或者灰度版本. 本 ...

  5. H5+js调用相机

    在机缘巧合之下,了解到用HTML5和javascript调用摄像头来实现拍照功能,今天就把大致原理写下来.页面布局很简单,就是一个input标签,两个HTML5元素video.canvas和一个but ...

  6. Python 多进程爬虫实例

    Python  多进程爬虫实例 import json import re import time from multiprocessing import Pool import requests f ...

  7. django中安全sql注入等

    模拟sql注入 使用原生sql语句编写login登录逻辑 class LoginUnsafeView(View): def get(self, request): return render(requ ...

  8. Thinkphp5 实现动态模板主题多个模板切换

    在项目开发过程中会遇到一个网站有不同风格,本文详细介绍Thinkphp5 实现模板主题多个模板切换 一.在Config中配置view_path模板路径代码如下 1 2 3 4 5 6 7 8 9 10 ...

  9. 【GMT43智能液晶模块】例程十八:LAN_HTTP实验——网页服务器

    源代码下载链接: 链接:https://pan.baidu.com/s/1sr4a7TBPyvs18jTfCfVj8Q 提取码:jwfv 复制这段内容后打开百度网盘手机App,操作更方便哦 GMT43 ...

  10. asp.net msbuild 发布

    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe ...