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

패키지 상세v1.3.0

action_cable

Dart에서 사용 가능한 ActionCable 클라이언트로 웹, dartVM 및 플러터에서 사용 가능합니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
1.5천
좋아요
22
Pub 점수
135

패키지 설치

flutter pub add action_cable

패키지 개요

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

ActionCable는 Rails의 ActionCable에 대한 Dart 클라이언트 구현으로, Flutter 및 Dart 애플리케이션에서 WebSocket을 통해 실시간 양방향 통신을 가능하게 합니다. 웹, DartVM, 그리고 안드로이드, iOS, macOS, Windows, Linux와 같은 모바일 플랫폼을 지원합니다. 라이브 업데이트, 채팅 시스템, 알림과 같은 기능을 위해 ActionCable 서버와 원활하게 통합할 수 있습니다. 채널 구독, 메시지 수신, 연결 관리를 위한 깔끔한 API를 제공하며 내장된 재연결 로직도 포함되어 있습니다. 실시간 데이터 동기화가 필요한 앱에 적합합니다.

사용 사례

  • 실시간 채팅 애플리케이션
  • 실시간 대시보드 업데이트
  • 알림 시스템
  • 협업 편집 도구
  • 스트리밍 데이터 피드

주요 기능

  • WebSocket 기반 실시간 통신
  • 크로스 플랫폼 지원 (웹, 모바일, 데스크톱)
  • 채널 구독 관리
  • 자동 재연결
  • 간단한 이벤트 기반 API

적합한 대상

  • 실시간 기능이 필요한 Flutter 앱
  • Rails 백엔드를 사용하는 Dart 프로젝트
  • 실시간 상호작용형 UI를 구축하는 개발자
  • 저지연 업데이트가 필요한 앱
  • 서버 측에서 ActionCable를 사용하는 팀

고려 사항

  • 호환되는 ActionCable 서버가 필요합니다
  • 네트워크 신뢰성이 성능에 영향을 미칩니다
  • 성숙한 대안에 비해 문서화가 제한적
  • 메시지 파싱을 수동으로 처리해야 합니다
  • 조정 없이 고주파, 저지연 시나리오에 적합하지 않습니다

원본 README

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

Pub

All Contributors

ActionCable in Dart

ActionCable is the default realtime websocket framework and protocol in Rails.

This is a dart port of the client and protocol implementation which is available in web, dartVM and flutter.

Usage

Connecting to a channel 🙌
cable = ActionCable.connect(
  "ws://10.0.2.2:3000/cable",
  headers: {
    "Authorization": "Some Token",
  },
  onConnected: (){
    print("connected");
  },
  onConnectionLost: () {
    print("connection lost");
  },
  onCannotConnect: () {
    print("cannot connect");
});
Subscribing to channel 🎉
cable.subscribe(
  "Chat", // either "Chat" and "ChatChannel" is fine
  channelParams: { "room": "private" },
  onSubscribed: (){}, // `confirm_subscription` received
  onDisconnected: (){}, // `disconnect` received
  onMessage: (Map message) {} // any other message received
);
Unsubscribing from a channel 🎃
cable.unsubscribe(
  "Chat", // either "Chat" and "ChatChannel" is fine
  {"room": "private"}
);
Perform an action on your ActionCable server 🎇

Requires that you have a method defined in your Rails Action Cable channel whose name matches the action property passed in.

cable.performAction(
  "Chat",
  action: "send_message",
  channelParams: { "room": "private" },
  actionParams: { "message": "Hello private peeps! 😜" }
);
Disconnect from the ActionCable server
cable.disconnect();

ActionCable protocol

Anycable has a great doc on that topic.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Clinton

💻 ⚠️

Hamad AlGhanim

💻

Fareesh Vijayarangam

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

아직 데이터가 없습니다.