0.0.10 • Published 7 years ago

CordovaWebSocketClientCert v0.0.10

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

cordova-websocket-clientcert

This plugin provides a custom websocket implemenation for javascript supporting client side PKCS12 certificates.

Supported platforms

  • android
  • ios

Installation

cordova plugin add CordovaWebSocketClientCert

Note

For the time being all servers are trusted

Usage

var url = 'wss://hostname:port/path'; 
var certFile = '/absolute/path/myCert.p12'; // absolute path of the filesystem (see https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/#android-file-system-layout)
var certPass = 'Secure123';

var ws = new WebSocketClient(url, certFile, certPass);
ws.onopen = function () {
    //socket open
}

ws.onclose = function () {
    //socket closed
}

ws.onerror = function () {
    //socket error
}

ws.onmessage = function (message) {
    var data = message.data;
}

ws.send(JSON.stringify({a: 1, b: 2}), function () {
    //success callback
}, function () {
    //error callback
});

Example using "cordova-plugin-file":

resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory, function (dirEntry) {
    var certPath = dirEntry.fullPath  + 'myCert.p12';
    var ws = new WebSocketClient('wss://hostname:port/path', certPath, 'somePassword');

    ...
}, console.log);
0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago