You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

react-native-websocket-ssl-pinning

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

react-native-websocket-ssl-pinning

Creates a secure WebSocket connection using ssl-pinning technique

0.8.1
unpublished
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
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

react-native

FAQs

Package last updated on 07 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