패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.21.0

centrifuge

Flutter 및 VM에서 WebSocket을 통해 Centrifuge와 Centrifugo와 통신하기 위한 Dart 클라이언트

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
7.7만
좋아요
49
Pub 점수
140

패키지 설치

flutter pub add centrifuge

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Centrifuge는 WebSocket을 통해 Centrifuge 및 Centrifugo 서버와 실시간 통신을 위한 Dart 클라이언트입니다. Flutter 및 VM 애플리케이션에서 채널에 구독하고 실시간 업데이트를 수신하며 메시지를 발행할 수 있게 해줍니다. 낮은 지연 시간 상호작용을 위해 설계되었으며, 연결 관리, 재접속 로직, 여러 플랫폼 간 메시지 브로드캐스팅을 지원합니다. 채팅 앱, 실시간 대시보드, 즉각적인 데이터 동기화가 필요한 협업 도구 개발에 적합합니다.

사용 사례

  • 실시간 채팅 애플리케이션
  • 실시간 대시보드 업데이트
  • 협업 편집 도구
  • 푸시 알림
  • 멀티플레이어 게임 동기화

주요 기능

  • WebSocket 기반 실시간 통신
  • 자동 재연결
  • 채널 구독 및 게시
  • 크로스 플랫폼 지원
  • 경량이고 효율적
  • 보안 토큰 인증

적합한 대상

  • Flutter 모바일 및 웹 앱
  • 서버 측 Dart 서비스
  • 실시간 데이터 스트리밍
  • 고주파 이벤트 처리

고려 사항

  • 실행 중인 Centrifuge 또는 Centrifugo 서버가 필요합니다
  • 적절한 인증 설정이 필요합니다
  • 모바일에서 네트워크 권한 구성이 필요할 수 있습니다
  • 안정적인 WebSocket 연결에 의존합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Websocket client for Centrifugo server and Centrifuge library.

Since there is no v1 release yet, patch version updates only contain backwards compatible changes, minor version updates can have backwards incompatible API changes.

Check out client SDK API specification to learn how this SDK behaves. It's recommended to read that before starting to work with this SDK as the spec covers common SDK behavior - describes client and subscription state transitions, main options and methods. Also check out examples folder.

The features implemented by this SDK can be found in SDK feature matrix.

Note that custom WebSocket connection Upgrade headers are sent natively on platforms that support dart:io and in web context headers are sent using Centrifugo v6 Headers Emulation feature.

The latest centrifuge-dart is compatible with Centrifugo server v6, v5 and v4 and Centrifuge >= 0.25.0. For Centrifugo v2, Centrifugo v3 and Centrifuge < 0.25.0 you should use centrifuge-dart v0.8.0.

Examples

  • example\flutter_app simple chat application
  • example\chat_app one more chat example
  • example\console simple console application

Usage in background

When a mobile application goes to the background there are OS-specific limitations for established persistent connections - which can be silently closed shortly. Thus in most cases you need to disconnect from a server when app moves to the background and connect again when app goes to the foreground.

Alternative SDK

See also PlugFox/spinify for an alternative Dart (Flutter) real-time client SDK implementation.

Run tests locally

Start test Centrifugo server:

docker compose up

Then run tests:

dart run test --reporter expanded

Instructions for maintainers/contributors

How to update protobuf definitions
  1. Install protoc compiler
  2. Install protoc_plugin https://pub.dev/packages/protoc_plugin (dart pub global activate protoc_plugin)
  3. cd lib/src/proto and run protoc --dart_out=. -I . client.proto
  4. cd to root and run dartfmt -w lib/ test/ (install dartfmt with dart pub global activate dart_style)
How to release
  1. Update CHANGELOG.md, bump version in pubspec.yaml, push, create new tag
  2. [ONLY IF THERE ARE ISSUES WITH CI PUBLISH] dart pub publish

Author

German Saprykin, saprykin.h@gmail.com

카테고리

의존성

의존성 목록 4 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위