1.6.10 • Published 1 year ago

droppay-sensor-js v1.6.10

Weekly downloads
10
License
MIT
Repository
gitlab
Last release
1 year ago

DropPay SensorJS

A driver oriented realtime communication library.

Installation

Using NodeJS npm command

npm install droppay-sensor-js -S

Using plain javascript on browsers

<script type="application/ecmascript" src="dist/sensor.js">

Supported Drivers

API

  • connect
  • disconnect
  • subscribe
  • unsubscribe
  • addListener
  • removeListener
  • release
  • publish

connect()

Initialize a connection with the service provider.

disconnect()

Close connection with the service provider.

subscribe(ChannelId: String/Array)

Subscribe to a specific channel. Depending on the driver an array of channels can be used.

unsubscribe(ChannelId: String/Array)

Unsubscribe from a specific channel. Depending on the driver an array of channels can be used.

addListener(callback(id: int, message: Object): Function)

Add a listener to the messages queue. Anytime a message is received on the subscribed channel(s) through the estabilished connection, all listeners are notified.

removeListener(callback: Function)

Wipe off a listener from the queue.

release()

Release all channels and disconnect from service provider endpoint.

publish(name/channel: String, payload: String/Object, callback: Function)

Send a payload to the subscribed channel through the estabilished connection. Name/Channel are mandatory, depending on the driver used they can be a message NAME. or a CHANNEL_ID.

Example (PubNub)

import DropPaySensorJS from 'droppay-sensor-js';

const sensor = DropPaySensorJS('pubnub', {
    subscribeKey: 'sub-xxx',
    publishKey: 'pub-xxx',
    ssl: true
});

sensor.addListener((message)=>{
    console.log('received message: ' + JSON.stringify(message))
});

sensor.subscribe('myChannel');

sensor.publish('myChannel', (status, response)=>{
    if (status.error) {
        // handle error
        console.log(status)
    } else {
        console.log("message Published w/ timetoken", response.timetoken)
    }
});

sensor.unsubscribe('myChannel');

sensor.release();
document version 1.0 by Giuseppe Marletta 07/12/2018
1.6.10

1 year ago

1.6.9

1 year ago

1.6.8

1 year ago

1.6.7

1 year ago

1.6.6

1 year ago

1.6.4

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.5

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.9

6 years ago

1.3.8

6 years ago

1.3.7

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.46

6 years ago

1.1.45

7 years ago

1.1.44

7 years ago

1.1.43

7 years ago

1.1.42

7 years ago

1.1.41

7 years ago

1.1.40

7 years ago

1.1.39

7 years ago

1.1.38

7 years ago

1.1.37

7 years ago

1.1.36

7 years ago

1.1.35

7 years ago

1.1.34

7 years ago

1.1.33

7 years ago

1.1.32

7 years ago

1.1.31

7 years ago

1.1.30

7 years ago

1.1.29

7 years ago

1.1.28

7 years ago

1.1.27

7 years ago

1.1.26

7 years ago

1.1.25

7 years ago

1.1.24

7 years ago

1.1.23

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago