Socket
Socket
Sign inDemoInstall

pusher-nativescript

Package Overview
Dependencies
39
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pusher-nativescript

Pusher plugin for NativeScript with support to iOS and Android platforms


Version published
Weekly downloads
0
decreased by-100%
Maintainers
4
Install size
1.87 MB
Created
Weekly downloads
 

Readme

Source

Pusher Nativescript

Pusher NativeScript adds Pusher support to {N} applications.

There is not official support for NativeScript in pusher-js sdk, but the Pusher team made a great work designing the JS library to target multiple platforms (react-native, node, browser, etc), while reusing a lot of code in the process. Taking advantage of that architecture, we were able to create a version of the pusher-js sdk that maintains the original API and provides support for NativeScript.

Usage

You can install the library using any npm compatible package manager, like npm or yarn:

$ npm install --save pusher-nativescript

Or use NativeScript CLI:

$ tns plugin add pusher-nativescript

Once the package has been installed, you can import it

As a CommonJS module:

const Pusher = require('pusher-nativescript');

Or ES6 module:

import Pusher from 'pusher-nativescript';

If you are using Typescript you might have to import it like this:

import * as Pusher from 'pusher-nativescript';

This build of pusher-js uses NativeScript's Connectivity API to detect changes on connectivity state. It will use this to automatically reconnect.

On Android, to access any connection related information we will need explicit permission from the user. To enable the permission request add the follwing in app/App_Resources/Android/AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

NativeScript do not have official support for WebSockets. We are relying on nativescript-websockets plugin to add that support. That is why the plugin is a peer dependency.

As it was mentioned above, pusher-nativescript shares the same API as the official pusher-js library. To see how the library is used and configured checkout pusher-js repository.

Credits

Keywords

FAQs

Last updated on 14 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc