Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

A pusher.com client written with dart for flutter

License

Notifications You must be signed in to change notification settings

heywhy/flutter-pusher-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ac2064b · Sep 21, 2021

History

11 Commits
Jul 17, 2020
Jul 17, 2020
Jul 17, 2020
Jul 17, 2020
Nov 24, 2019
Jan 15, 2020
Nov 24, 2019
Nov 24, 2019
Jul 17, 2020
Nov 25, 2019
Sep 21, 2021
Nov 25, 2019
Jul 17, 2020
Jul 17, 2020

Repository files navigation

This project has now been archived, see comment for more information.

Pusher Flutter Client

pub package

An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS.

This package lets you consume events from a Pusher server. In order to use this library, you need to have a free account on http://pusher.com. After registering, you will need the application credentials for your app.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

How to install

  • Add to your pubspec.yaml
dependencies:
  flutter_pusher_client: ^0.1.0

Getting Started

import 'package:flutter_pusher_client/flutter_pusher.dart';

void main() {

  var options = PusherOptions(host: '10.0.2.2', port: 6001, encrypted: false);
  FlutterPusher pusher = FlutterPusher('app', options, enableLogging: true);

  pusher.subscribe('channel').bind('event', (event) => {});
}

Lazy Connect

Connection to the server can be delayed, so set the lazyConnect prop on the client constructor.

R8/Proguard code obfuscation

If you have enabled code obfuscation with R8 or proguard, you need to add the following rule.

android/app/build.gradle:

buildTypes {
  release {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  }
}

android/app/proguard-rules.pro:

-keep class com.github.heywhy.flutter_pusher.** { *; }

Development

Generate the models and the factories: flutter packages pub run build_runner build --delete-conflicting-outputs