1.3.0 • Published 7 years ago

react-native-realtime-pusher v1.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

react-native-realtime-pusher

Implementing the Pusher Realtime API for Android and iOS.

Installation Android

yarn add react-native-realtime-pusher

In settings.gradle add the following lines:

include ':Pusher'
project(':Pusher').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-realtime-pusher/android')

In build.gradle add the following line:

compile project(':Pusher')

In MainApplication.java add the following lines:

import com.gijoehosaphat.pusher.PusherPackage;
new PusherPackage()

Example usage:

import Pusher from 'react-native-realtime-pusher'
...
// These values determined by *your* setup on *your* backend.
// hostname ~= http://myserver.com
// authPath ~= /auth
// channelPath ~= /channel
Pusher.initialize(hostname, authPath, channelPath, appKey, cluster, token) //This is a Promise
...
//Connect (There is also disconnect)
Pusher.connect() //This is a Promise
...
//Subscribe to a channel (There is also channelUnsubscribe)
Pusher.channelSubscribe(channel, channelEventName) //This is a Promise
...
//Send a message
Pusher.messagePost(messageObject, channelName, channelEvent) //This is a promise
...
//You will want to listen for events:
componentDidMount() {
  DeviceEventEmitter.addListener('pusher-event', this.yourEventHandler)
}
componentWillUnmount() {
  DeviceEventEmitter.removeAllListeners('pusher-event')
}
1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago