New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-websocket-ssl-pinning

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-websocket-ssl-pinning

Creates a secure WebSocket connection using ssl-pinning technique

  • 0.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

react-native-websocket-ssl-pinning

Creates a secure WebSocket connection using ssl-pinning technique.

Installation

yarn add react-native-websocket-ssl-pinning

API

Methods

fetch(string: url, any: obj)

Attempts to open the WSS connection to specified endpoint. Certs must be .cer format

Example:

      fetch(`wss://${domain}/`, {
        method: 'GET',
        sslPinning: {
          certs: ['rootCA_public'],
        },
      });
sendWebSocketMessage(string: message)

Sends a messaage. Must be called after fetch.

terminateWebSocket(void)

Aggressively stops the web socket connection and instance

closeWebSocket(string: reason)

Closes the web socket.

Members

NativeEventEmitter eventEmitter

Requires the following listeners: 'onOpen' 'onClosed' 'onFailure' 'onMessage'

Each listener requires a callback function.

Example:

openListener = eventEmitter.addListener('onOpen', socketOpen);
closeListener = eventEmitter.addListener('onClosed', socketClosed);
messageListener = eventEmitter.addListener('onMessage', socketMsg);
failureListener = eventEmitter.addListener('onFailure', socketFailed);

// when web socket is terminated, clean up the listeners
openListener.remove();
closeListener.remove();
messageListener.remove();
failureListener.remove();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Keywords

FAQs

Package last updated on 04 Feb 2025

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc