搜索插件、代码仓与 APP 分类

插件详情v3.0.3

web_socket_channel

WebSockets 的 StreamChannel 包装器。提供跨平台的 WebSocketChannel API,以及基于底层 StreamChannel 通信的跨平台 API 实现。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1290万
喜欢数
1650
Pub 分数
150

安装插件

flutter pub add web_socket_channel

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

web_socket_channel 包为 WebSocket 通信提供了一个跨平台 API,通过包装 StreamChannel 实现了跨平台的一致性 WebSocket 处理。它提供了一个统一的接口,用于建立和管理 WebSocket 连接,抽象了底层平台差异。基于 Dart 的 StreamChannel 构建,它通过流支持双向数据传输,非常适合实时应用。该包专为针对 Android、iOS、Web、macOS、Windows 和 Linux 的 Flutter 应用设计,确保与现有基于流的架构无缝集成。

适合场景

  • 实时聊天应用
  • 仪表板中的实时数据更新
  • 多人游戏同步
  • 物联网设备通信
  • 流式分析数据

主要特点

  • 跨平台 WebSocket 支持
  • 基于 StreamChannel 的 API
  • 双向数据流
  • 跨平台的一致性界面
  • 内置的错误处理和重连逻辑

适合对象

  • Flutter 开发人员构建实时功能
  • 需要持久服务器连接的应用程序
  • 针对多个平台的项目
  • 基于流的数据架构
  • 需要可靠 WebSocket 传输的应用程序

使用建议

  • 需要底层的 StreamChannel 实现
  • 可能需要额外的错误处理以用于生产环境
  • 不适用于非WebSocket协议
  • 依赖于 Dart 的异步功能
  • 仅限 WebSocket 特定用例

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Build Status

A composable, Future-based library for making HTTP requests.

package:http contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.

Packages

Package Description Version
cronet_http An Android Flutter plugin that provides access to the Cronet HTTP client. pub package
cupertino_http A macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System. pub package
flutter_http_example An Flutter app that demonstrates how to configure and use package:http. —
http A composable, multi-platform, Future-based API for HTTP requests. pub package
http2 A HTTP/2 implementation in Dart. pub package
http_client_conformance_tests A library that tests whether implementations of package:http's Client class behave as expected.
http_multi_server A dart:io HttpServer wrapper that handles requests from multiple servers. pub package
http_parser A platform-independent package for parsing and serializing HTTP formats. pub package
http_profile A library used by HTTP client authors to integrate with the DevTools Network View. pub package
ok_http An Android Flutter plugin that provides access to the OkHttp HTTP client and the OkHttp WebSocket API. pub package
web_socket Any easy-to-use library for communicating with WebSockets that has multiple implementations. pub package
web_socket_channel StreamChannel wrappers for WebSockets. Provides a cross-platform WebSocketChannel API. package issues
web_socket_conformance_tests A library that tests whether implementations of package:web_socket's WebSocket class behave as expected.

Contributing

If you'd like to contribute to any of these packages, see the Contributing Guide.

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目