Using PubNub with React Native

Has anyone been able to integrate PubNub with React Native?

The PubNub support team told me to use the pubnub_browserify package and it should work. However, when I do require('pubnub_browserify') , I get an error that the http module was not found:

Unable to resolve module http from /Users/jfender/Documents/Workspace/KaiwaReact/node_modules/pubnub_browserify/browserify_node/pubnub.js: Invalid directory /Users/node_modules/http

Running npm install http --save does not change the error.

I am using Node v5.1.0, npm 3.3.12 and React Native 0.14.2.

Here is my package.json:

 { "name": "KaiwaReact", "version": "0.0.1", "private": true, "scripts": { "start": "react-native start" }, "dependencies": { "eslint": "^1.10.0", "eslint-plugin-react": "^3.9.0", "parse": "^1.6.9", "parse-react": "^0.5.0", "pubnub_browserify": "^1.0.2", "react-native": "^0.14.2" } } 
+5
react-native pubnub
source share
3 answers

I managed to integrate it. I used the standard javascript package. However, I had to change it a bit. Basically remove all links to the "window" and "abort". As soon as I deleted them, I was ready to go.

+2
source share

PubNub has a new Javascript SDK (v4). You should be able to add the dependency to your package.json file and import it into your code. Here is a short example of an application that subscribes to the PubNub channel.

https://github.com/girishd/ReactPubNub

0
source share

Try using https://www.npmjs.com/package/pubnub (version 3.7.16) (npm install pubnub) This version works with reaction

-one
source share

All Articles