
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@thrash-industries/react-actioncable-provider
Advanced tools
This package provides an ActionCable context provider and consumer to allow you to subscribe to ActionCable channels in your React components.
As this package uses React's new Context API, React 16.3+ is required.
Run npx browserslist
to see default, not ie 11
option in .browserslistrc
compatibility. There is no IE 11 support starting in version 4.0.0.
npm install --save @thrash-industries/react-actioncable-provider
# OR
yarn add @thrash-industries/react-actioncable-provider
The public API exports two components that you'll use: <ActionCableProvider />
and <ActionCableConsumer />
.
<ActionCableProvider />
The provider is used in an outer container and wraps all of the components that may or may not consume the context. It accepts one of two props: url
and cable
. Passing url
will result in the provider instantiating its own ActionCable.Consumer
with that URL. Passing cable
allows you to manually instantiate an ActionCable.Consumer
on your own and pass it to the provider to be used by all descendent consumers.
url
<ActionCableProvider url="ws://test.example.com/cable">...</ActionCableProvider>
cable
import ActionCable from "actioncable";
const cable = ActionCable.createConsumer("ws://test.example.com/cable");
<ActionCableProvider cable={cable}>...</ActionCableProvider>;
<ActionCableConsumer />
The consumer will wrap an individual component. It accepts several props:
channel
[String] Name of the channel to which you want to subscribe.channel
[Object] An object with a channel
key which denotes the channel to which you want to subscribe. All other keys are passed to the channel as params.onConnected
[Function] A handler function that is called when the channel connects.onDisconnected
[Function] A handler function that is called when the channel disconnects.onInitialized
[Function] A handler function that is called when the ActionCable
.Consumer
is initialized.onRejected
[Function] A handler function that is called when the requested subscription is rejected.onReceived
[Function] A handler function that is called when the channel transmits a message to the client.import React from "react";
import PropTypes from "prop-types";
import { ActionCableConsumer } from "@thrash-industries/react-actioncable-provider";
export default class Widget extends React.Component {
static propTypes = {
message: PropTypes.string
};
constructor(...props) {
super(...props);
this.handleReceived = this.handleReceived.bind(this);
this.state = {
message: ""
};
}
handleReceived(message) {
this.setState(state => {
return {
message
};
});
}
render() {
return (
<ActionCableConsumer
channel="WidgetChannel"
onReceived={this.handleReceived}
>
<h1>{this.state.message}</h1>
</ActionCableConsumer>
);
}
}
yarn
Install dependenciesyarn test
Run testsyarn build
Build for productionnpm version [patch|minor|major]
Increment versionnpm publish
Publish to npmSee https://github.com/cpunion/react-native-actioncable
See https://github.com/cpunion/react-actioncable-provider/issues/8
Example: https://github.com/cpunion/react-actioncable-ssr-example
FAQs
ActionCable Provider for React
We found that @thrash-industries/react-actioncable-provider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.