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应 ...
随机推荐
- Oracle 03113
SYSTEM的只有2M可以用了,还是需要 扩增 SYSTEM和SYSAUX的表空间 SELECT a.tablespace_name,a.bytes/1024/1024 total_M,b.bytes ...
- 【转】解决chrome浏览器不支持audio和video标签的autoplay自动播放
声音无法自动播放这个在 IOS/Android 上面一直是个惯例,桌面版的 Safari 在 2017 年的 11 版本也宣布禁掉带有声音的多媒体自动播放功能,紧接着在 2018 年 4 月份发布的 ...
- Manifest中meta-data扩展元素数据的配置与获取
简介-meta是什么 在AndroidManifest.xml清单文件中 我们有时会看到如下类似的<meta-data ... >元素开始的配置内容: <meta-data andr ...
- Default Activity Not Found解决方法
2018年04月07日 17:22:44 Luckily_Liu 阅读数 13573更多 分类专栏: android 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上 ...
- kotlin基础 字符串比较 equal
strring.equal(str,boolean) boolean=False,默认值,区分大小写 boolean=True,不区分大小写
- 理解 uptime 的:“平均负载”? 如何模拟测试
每次发现系统变慢时,我们通常做的第一件事,就是执行 top 或者 uptime 命令,来了解系统的负载情况.比如像下面这样,我在命令行里输入了 uptime 命令,系统也随即给出了结果. [root@ ...
- fatal error: sys/videoio.h: No such file or directory
Determining if the include file sys/videoio.h exists failed with the following output:Change Dir: /h ...
- 转 RAC单个节点执行expdp提示ORA-31693 ORA-31617 ORA-19505 ORA-27037错误
http://blog.itpub.net/31394774/viewspace-2217567/ 1.在RAC单节点执行expdp,出现ORA-31693 ORA-31617 ORA-19505 O ...
- SVN中trunk,branches,tags用法详解[重要]
Subversion有一个很标准的目录结构,是这样的.比如项目是proj,svn地址为svn://proj/,那么标准的svn布局是 svn://proj/|+-trunk+-branches+-ta ...
- 一段隐藏文字的css代码,记录下
<span style="width:1px; height:1px; color:#fff; outline-width:hidden; overflow:hidden; displ ...