2.9.0-snapshot.14 • Published 2 months ago

podasync-ws-only v2.9.0-snapshot.14

Weekly downloads
14
License
MIT
Repository
github
Last release
2 months ago

Synopsis

Fanap's POD Async service (DIRANA) - Websocket Only

Code Example

First you have to require PodAsync in your project.

var Async = require('podasync-ws-only');

To be able to connect to async server, you should set some parameters. Websocketsprotocol is currently supported.

Websocket protocol parameters

var params = {
  socketAddress: "ws://chat-sandbox.pod.land/ws",
  serverName: "chat-server",
  reconnectOnClose: true,
  connectionCheckTimeout: 10000,
  asyncLogging: {
    onFunction: true,
    onMessageReceive: true,
    onMessageSend: true
  }
};

After setting parameters you can make a new connection to Async server.

var asyncClient = new Async(params);

Async Ready Event

After making a new connection, you should wait for asyncReady event to fire so you could be sure that the connection has been estabilished and you are ready to go

asyncClient.on("asyncReady", function() {
  /**
  * Write your code inside asyncReady() function
  */
});

Receive messages

In order to receive messages from Async server, you could listen to message event.

/**
* Listening to responses came from DIRANA
*/
asyncClient.on("message", function(message, ack) {
  console.log(message);
});

Send message

To send a new message to Async server you can use send() function.

/**
* A Custom Message To be Send Through DIRANA
*/
var customMessage = {
  type: 3,
  content: {
    receivers: ["receiver1", "receiver2", "..."],
    content: "Hello Buddy!"
  }
};

/**
* Sending Message
*/
asyncClient.send(customMessage);

Motivation

This module helps you to easily connect POD chat service.

Installation

npm install podasync --save

API Reference

API Docs from POD

Tests

npm test

Contributors

You can send me your thoughts about making this repo great :) Email

License

Under MIT License.

2.9.0-snapshot.36

2 months ago

2.9.0-snapshot.35

2 months ago

2.9.0-snapshot.30

7 months ago

2.9.0-snapshot.32

7 months ago

2.9.0-snapshot.31

7 months ago

2.9.0-snapshot.34

7 months ago

2.9.0-snapshot.33

7 months ago

2.9.0-snapshot.27

8 months ago

2.9.0-snapshot.26

8 months ago

2.9.0-snapshot.29

8 months ago

2.9.0-snapshot.28

8 months ago

2.9.0-snapshot.23

8 months ago

2.9.0-snapshot.25

8 months ago

2.9.0-snapshot.24

8 months ago

2.9.0-snapshot.5

12 months ago

2.9.0-snapshot.4

12 months ago

2.9.0-snapshot.10

10 months ago

2.9.0-snapshot.7

11 months ago

2.9.0-snapshot.6

12 months ago

2.9.0-snapshot.12

9 months ago

2.9.0-snapshot.9

11 months ago

2.9.0-snapshot.11

9 months ago

2.9.0-snapshot.8

11 months ago

2.9.0-snapshot.14

9 months ago

2.9.0-snapshot.3

12 months ago

2.9.0-snapshot.16

9 months ago

2.9.0-snapshot.15

9 months ago

2.9.0-snapshot.18

9 months ago

2.9.0-snapshot.17

9 months ago

2.9.0-snapshot.19

9 months ago

2.9.0-snapshot.21

8 months ago

2.9.0-snapshot.20

9 months ago

2.9.0-snapshot.22

8 months ago

2.9.0-snapshot.2

12 months ago

2.7.11

1 year ago

2.7.9-snapshot.0

2 years ago

2.7.9

3 years ago

2.7.8

3 years ago

2.7.7

3 years ago

2.7.5

5 years ago