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应 ...
随机推荐
- mybatis-generator 模板
generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ge ...
- docker jenkins 插件安装提速
公司安装的jenkins 自动布署服务挂了,好像有漏洞一直搞,打算重新安装一个,随便再学习一下 一上来就用docker 解决问题 #!/bin/bash docker stop myjenkins d ...
- Python 下载依赖包环境经常失败超时解决方法
人生苦短,我用python!为什么很多人喜欢用python,因为包多呀,各种调包.但是调包有的时候也调的闹心,因为安装包不是失败就是很慢,很影响自己的工作进度,这里给出一个pip快速安装工具包的办法, ...
- Maven 常用工具类整理
目录 1.Apache Commons 1.1.字符串处理 1.2.集合操作 1.3.IO操作 1.4.编解码操作 2.Google Guava 2.1.多场景使用 2.2.guava-retryin ...
- laydate.render报错:日期格式不合法
在使用laydate渲染日期时: laydate.render({ elem: '#day' }); 提示日期格式不合法 需要使用 too.dateType()来包装 <input type=& ...
- dotnet core 项目脚手架这种小事嘛...
dotnet core脚手架批处理.bat @echo 请修改批处理文件名后,如:Example.Core ,注释掉goto end,再执行脚本 pause goto end ::goto end s ...
- DELPHI 数据库控件心得
TField对象的SetText和GetText事件处理函数 使用TField对象的SetText和GetText事件处理函数可方便的解决字段的代码与代码所对应值的显示问题 TSimpleDatase ...
- ubuntu 16 typora 安装 ,14系统的不管用。。
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE linuxidc@linuxidc:~ ...
- 配置windows live writer
下载地址 https://pan.baidu.com/s/1WVpLQEadIHN15W2DIhWh4A 安装流程参考博客 https://www.cnblogs.com/haseo/p/376232 ...
- Docker Compose 部署Nginx服务实现负载均衡
Compose简介: Compose是Docker容器进行编排的工具,定义和运行多容器的应用,可以一条命令启动多个容器,使用Docker Compose,不再需要使用shell脚本来启动容器.Comp ...