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应 ...
随机推荐
- 混合高斯分布与 EM 算法
极大似然估计在混合高斯分布中遇到的困难 在一般的情况下,对于所得到的样本集,\(X=\left\{x_{1}, \dots, x_{N}\right\}\),我们的目标是最大化似然函数,通过最大化似然 ...
- 使用MeadCo's ScriptX控件做WEB打印
官方网址:http://www.meadroid.com/scriptx/index.asp MeadCo's ScriptX控件有两种使用方式,一种是做为免费版本使用,一种是做为收费版本使用,免费版 ...
- Hyper-V中安装CentOS7设置静态ip并且可以连接外网
https://blog.csdn.net/xj19940904/article/details/89165002 https://blog.csdn.net/u011598235/article/d ...
- JPA连接PG数据库时间类型查询报错的修改
PG数据库中的时间格式规范: https://blog.csdn.net/sky_limitless/article/details/79527665 to_data 转换为 普通的时间格式 to_t ...
- 利用FUSE编写自定义的文件系统
FUSE--用户空间文件系统(Filesystem in Userspace),具体可以度娘,反正是简化了自定义文件系统的复杂度,可以更方便地利用自定义文件系统做一些事情. 一.使用 Python 编 ...
- javascript常用方法 - String
// 1.长字符串 // 1.1 let longString1 = "This is a very long string which needs " + "to wr ...
- 支付宝小程序开发——获取位置API没有城市区号的最佳处理方案
前言: 需要对城市区号进行判断,但是支付宝小程序提供的my.getLocation() API返回的数据中只有6位的城市行政代码,诸如:深圳(440300),并没有区号(0755),那么怎么办呢? 需 ...
- SDN实验---Ryu的应用开发(四)北向接口RESTAPI
一:推文 软件定义网络基础---REST API概述 软件定义网络基础---REST API的设计规范 二:掌握Ryu基本RESTAPI使用方法 (一)Ryu的RESTAPI (二) REST应用样例 ...
- [原]部署kubernetes dashboard(二)
####################### 以下为声明 ##################### 此文档是之前做笔记在两台机上进行的实践,kubernetes处于不断开发阶段 不能保证每 ...
- 【论文阅读】PBA-Population Based Augmentation:Efficient Learning of Augmentation Policy Schedules
参考 1. PBA_paper; 2. github; 3. Berkeley_blog; 4. pabbeel_berkeley_EECS_homepage; 完