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. kafka外部访问设置

    一.broker参数 broker.id:kafka集群的唯一标识. log.dirs:kafka存储消息日志的目录,多个用逗号隔开,需要保证指定的目录有充足的磁盘空间. zookeeper.conn ...

  2. 在 Alpine Linux 中安装 bash shell

    如何在我的 Alpine Linux LXD(Linux容器)虚拟机(VM)中安装 bash shell? Alpine Linux 自带 BusyBox 工具.它被评为“嵌入式 Linux 的瑞士军 ...

  3. paddlepaddle如何预加载embedding向量

    使用小批量数据时,模型容易过拟合,所以需要对全量数据进行处理,我是用的是word2vec训练的词向量. 那么训练好对词向量如何加载呢? #!/usr/bin/env python # -*- codi ...

  4. ubuntu下编译C++程序

    1.CMake 定义:CMake是一个跨平台编译工具,可以用来自动输出makefile文件: 用法:(1)想要自动生成makefile,还需要编写对应的CMakeLists.txt文件: (2)在CM ...

  5. 【bat批处理】批量执行某个文件夹下的所有sql文件bat批处理

    遍历文件夹下所有的sql文件,然后命令行执行 for /r "D:\yonyou\UBFV60\U9.VOB.Product.Other" %%a in (*.sql) do ( ...

  6. LinkedHashMap原理

    作者:艺旭家 链接:https://www.jianshu.com/p/8f4f58b4b8ab 总结 LinkedHashMap是继承于HashMap,是基于HashMap和双向链表来实现的. Ha ...

  7. php7.4 更新特性

    PHP 7.4.0 Released! The PHP development team announces the immediate availability of PHP 7.4.0. This ...

  8. Windows Server 2008 R2怎样设置自动登陆(登录)

    方法一: 打开电脑“菜单”,右键点击“运行”,在对话框输入“control userpasswords2”,点击“确定”. 弹出的窗口取消勾选“要使用本机用户必须输入用户名和密码”,取消后点击“确定” ...

  9. Redis实现实时热点查询

    Redis内存淘汰 定义: 指的是用户存储的一些键被可以被Redis主动地从实例中删除,从而产生读miss的情况 机制存在原因: Redis最常见的两种应用场景为缓存和持久存储 首先要明确的一个问题是 ...

  10. kubernetes常用命令:缩容扩容回滚

    查看版本 kubectl version 查看节点 kubectl get nodes 部署app 说明: 提供deployment名称和app镜像地址(docker镜像地址) kubectl run ...