
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
pubnub-redux
Advanced tools
[](https://travis-ci.com/pubnub/redux)
The PubNub Redux SDK offers a data management framework that listens to realtime events generated by the PubNub network to update the view inside your application. And of course, your data can coexist with PubNub-defined data.
The Redux SDK is an npm
module that provides
Redux-specific functions which can be integrated with your existing or new Redux data store.
Note: This is a beta version of the PubNub Redux SDK
The PubNub Redux SDK includes the following components that you help manage your application’s state and PubNub server communications.
pubnub 4.28.3
or laterredux 4.0.4
or laterredux-thunk 2.3.0
or laterThis section provides the basic integration setps to connect the PubNub Redux SDK into your existing application. For an example of an application built on top of this SDK, go to our reference application site at: https://www.pubnub.com/docs/chat/quickstart
Before you can create an application with the PubNub Redux SDK, obtain a set of chat-optimized keys from your PubNub Dashboard.
In the following instructions, replace the following references with key values from your PubNub Dashboard.
myPublishKey
mySubscribeKey
npm install redux
npm install redux-thunk
npm install pubnub
npm install pubnub-redux
A Redux application manages all application state in a centralized location called the store. To gain the benefits offered by the PubNub Redux SDK, you must configure your store to include references to the PubNub libraries.
let pubnub = new Pubnub({
publishKey: "myPublishKey",
subscribeKey: "mySubscribeKey"
});
let rootReducer = combineReducers(
createNetworkStatusReducer(false),
createMessageReducer(),
createPresenceReducer(),
createUUIDMetadataReducer(),
createUUIDMetadataListReducer(),
createChannelMetadataReducer(),
createChannelMetadataListReducer(),
createMembershipReducer(),
createChannelMembersReducer(),
);
The PubNub Redux SDK uses Redux Thunk to manage the interaction with commands that execute PubNub API calls, process the responses, and dispatch Redux actions.
let thunkArgument = {
pubnub: {
api: pubnub
}
};
let middleware = applyMiddleware(ReduxThunk.withExtraArgument(thunkArgument));
let myStore = createStore(
rootReducer,
undefined,
middleware,
);
You can register all the listeners that are included in the PubNub Redux SDK.
pubnub.addListener(createPubnubListener(store.dispatch));
You can also choose to register only specific listeners and combine with other listeners in your application.
pubnub.addListener(
combineListeners(
createNetworkStatusListener(store.dispatch),
createMessageListener(store.dispatch),
createPresenceListener(store.dispatch),
// a custom listener
{
status: (status) => {
console.log(status)
}
}
)
);
This section contains a few examples of commands to get your started. This is not meant to be an exhaustive list. Also, you can create commands in your application that use our actions to meet your requirements.
dispatch(sendMessage({
channel: 'my-channel',
message: {
title: 'hello world',
body: 'This is our hello world message.'
}
}));
dispatch(setUserData({
uuid: 'my-user-id',
data: {
name: 'User Name'
}
}));
dispatch(fetchUserData({
uuid: 'my-user-id'
}));
dispatch(setChannelData({
channel: 'my-channel-id',
data: {
name: 'Channel Name'
}
}));
dispatch(setMemberships({
uuid: 'my-user-id',
channels: [{
id: 'channel-id'
}]
}));
FAQs
[](https://travis-ci.com/pubnub/redux)
The npm package pubnub-redux receives a total of 104 weekly downloads. As such, pubnub-redux popularity was classified as not popular.
We found that pubnub-redux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.