React native WebSocket Secure
npm install react-native-wss* v0.64.4
* v0.64.1
sh
npm i --save-dev react-native-wss
`
Add postinstall into project package.json scripts object
`js
"scripts": {
"postinstall": "node node_modules/react-native-wss/scripts/postinstall.js"
}
`$3
`sh
npm i
or
npm run postinstall
`$3
Now, you can use wss address with certificates. ( No need to import any other libs. )
`js
this._ws = new WebSocket( 'wss://192.168.0.1', [],
{
headers: { Authorization: 'Bearer 123' },
ca: '-----BEGIN CERTIFICATE-----\n\n-----END CERTIFICATE-----\n',
pfx: 'base64==',
passphrase: 'mustbedefinedforpfx'
});
``