IOWebSocketChannel.connect handle errors
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的更多相关文章
- [ES7] Handle Errors in Asynchronous Functions
This lesson shows how regular control flow statements such as try/catch blocks can be used to proper ...
- [Ramda] Handle Errors in Ramda Pipelines with tryCatch
Handling your logic with composable functions makes your code declarative, leading to code that's ea ...
- [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 ...
- 理解ASP.NET Core - 错误处理(Handle Errors)
注:本文隶属于<理解ASP.NET Core>系列文章,请查看置顶博客或[点击此处查看全文目录](https://www.cnblogs.com/xiaoxiaotank/p/151852 ...
- [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 ...
- Exceptions and Errors on iOS
异常:程序缺陷导致:不可恢复:给开发者使用: 错误:资源受限导致:可恢复:提示给用户. https://blog.jayway.com/2010/10/13/exceptions-and-errors ...
- 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 ...
- squid源码安装下的conf文件默认值和提示
# WELCOME TO SQUID 3.0.STABLE26# ----------------------------## This is the default Squid c ...
- Node.js高级编程读书笔记 - 4 构建Web应用程序
Outline 5 构建Web应用程序 5.1 构建和使用HTTP中间件 5.2 用Express.js创建Web应用程序 5.3 使用Socket.IO创建通用的实时Web应用程序 5 构建Web应 ...
随机推荐
- ModuleNotFoundError: No module named 'pymysql'
出现此提示表示系统中没有安装PyMySQL,可以通过pip PyMySQL进行安装. 安装之后,执行import pymysql仍然不可用! why? 检查后发现系统中存在python2与python ...
- What is the difference between UNION and UNION ALL?
What is the difference between UNION and UNION ALL? UNION removes duplicate records (where all colum ...
- Log4j 1.x版 引发线程blocked死锁问题(2008)
1. https://blog.csdn.net/zl378837964/article/details/84884934 2. 去掉debug
- Python 使用scapy 时报:ImportError: cannot import name 'NPCAP_PATH' 解决
解决办法:下载源码 https://github.com/secdev/scapy 下载完成后解压后里面有个scapy文件夹,把这个文件夹替换\Lib\site-packages\ 下的scapy 整 ...
- dubbo源码分析之基于SPI的强大扩展
https://blog.csdn.net/luoyang_java/article/details/86609045 Dubbo采用微内核+插件体系,使得设计优雅,扩展性强.那所谓的微内核+插件体系 ...
- tornado多进程模式不同进程写不同日志
#coding: utf- ''' Author: Time: Target: ''' import logging import logging.handlers import os import ...
- 【Vegas原创】MAC电脑升级系统无法开机的终极解决办法
MAC OS升级Mojave .Catalina ,老一代的MacBook会产生一种情况:无法开机.按电源键没反应,会有间断性的滋滋的声音,屏幕都不亮. 终极解决方法,就一个字:等. 我升级Mojav ...
- Eclipse中引入com.sun.image.codec.jpeg包报错的完美解决办法
转: Eclipse中引入com.sun.image.codec.jpeg包报错的完美解决办法 更新时间:2018年02月14日 17:13:03 投稿:wdc 我要评论 Java开发中 ...
- C++内存管理1-64位系统运行32位软件会占用更多的内存吗?
随着大容量内存成为电脑平台常规化的配置,在配置组装机时很多的用户都会选择8GB甚至是16GB的容量规格内存使用在自己的机器上,如果要将这8GB甚至是16GB的内容在系统使用时能充分利用起来的话,你平台 ...
- net core 环境部署的坑
1.supervisor “no such file” error. 检查指令是否正确,路径.dotnet环境是否正常 2.Couldn‘t find a valid ICU package inst ...