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. vue+elementui项目打包后样式变化问题

    博主刚刚解决了index.html空白问题,刚打开项目页面又发现了样式出现了大问题,样式与开发版本有很大不同,有些样式没有生效.利用搜索引擎,找到了问题所在以及解决办法:main.js中的引入顺序决定 ...

  2. Dubbo的集群容错与负载均衡策略及自定义(一致性哈希路由的缺点及自定义)

    Dubbo的集群容错策略 正常情况下,当我们进行系统设计时候,不仅要考虑正常逻辑下代码该如何走,还要考虑异常情况下代码逻辑应该怎么走.当服务消费方调用服务提供方的服务出现错误时候,Dubbo提供了多种 ...

  3. 考勤打卡机导出的excel考勤时间表如何生成实用的考勤表

    该excel表有如下结构 姓名\日期 周1 周2 周3 周4 周5 张三 7:3518:02 7:3518:02 7:46   17:56 李四 7:3518:02 7:02 18:00 18:02 ...

  4. ES6 - 函数扩展(函数参数默认值)

    函数参数默认值 ES6 之前,不能直接为函数的参数指定默认值,只能采用变通的方法. function log(x, y) { y = y || 'World'; console.log(x, y); ...

  5. 如何解决Windows 10屏幕字体缩放模糊问题

    https://www.ithome.com/html/win10/374911.htm 笔者前段时间买了一台小米笔记本Pro,除了有字体模糊的问题外,还是比较满意的.这台笔记本是15.6英寸,108 ...

  6. centos7.5环境下elasticserch5.6.15集群升级6.8.4

    节点的角色分片: node01 eus_mp_web01 : master,false node,false, ingest,true node02 eus_mp_es01 : master,true ...

  7. flutter 打包apk之后,安装在手机上无法访问网络解决方法

    </application> <uses-permission android:name="android.permission.READ_PHONE_STATE" ...

  8. linux驱动开发学习一:创建一个字符设备

    首先是内核初始化函数.代码如下.主要是三个步骤.1 生成设备号. 2 注册设备号.3 创建设备. #include <linux/module.h> #include <linux/ ...

  9. es内存不够

    8核32G 3台 ELS机器,当时只给es配置了8G内存,es的总体数据量大小将近30G(查看GET /_cat/shards?v)

  10. 后端&前端零碎知识点和注意问题

    后端 1. Spring自带的MD5加密工具类 import org.springframework.util.DigestUtils; String md5Password = DigestUtil ...