1.2.2 • Published 9 months ago

vhd-smpp-module-v1 v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

/*

Vhd Smpp Module 1.0

This is a Node.js module for handling SMPP (Short Message Peer-to-Peer) connections to send and receive SMS messages. It provides an easy-to-use interface to interact with the SMPP server.

Installation

To use this module, you need to have Node.js installed on your system. You can install the module using npm:

npm install smpp
npm install async

Constructor Parameters

port: The port number of the SMPP server. host: The host address of the SMPP server. username: The username for authenticating with the SMPP server. password: The password for authenticating with the SMPP server. autoEnquirePeriod: The period (in milliseconds) for auto-enquiring the link. Default value is 10000 (10 seconds).

Usage

  1. To use the VhdSmpp module, follow these steps:

Import the module in your code:

const VhdSmpp = require('./path/to/vhd-smpp.js');
  1. Create an instance of the VhdSmpp class with the required parameters:
const port = 2775; // Port number of the SMPP server
const host = 'smpp.server.com'; // Host address of the SMPP server
const username = 'your_username'; // Your SMPP server username
const password = 'your_password'; // Your SMPP server password

const smppClient = new VhdSmpp(port, host, username, password);
  1. Initialize event listeners for the SMPP session:
smppClient.initListners();
  1. Connect to the SMPP server:
smppClient.connect();

5.Bind the SMPP session:

smppClient.bindSmpp();

6.Send an SMS message

const smsOptions = {
  destination: 'recipient_number', // Recipient's phone number
  message: 'Your SMS message goes here', // The SMS content
  source: 'your_source_number', // (optional) Sender's phone number
  scheduleDelivery: 'scheduled_date_time' // (optional) Schedule the SMS delivery
};

smppClient.sendMessage(smsOptions, (response) => {
  console.log(response); // Handle the response from the SMPP server
});


```bash

7. Define event handlers for specific events:

```bash

smppClient.onEvent('event_name', (data) => {
  // Handle the event with the received data
});
  1. Disconnect from the SMPP server when done:
smppClient.disconnect();

Auto Enquire Link Period

The autoEnquirePeriod parameter specifies the period (in milliseconds) for auto-enquiring the link. This feature helps in keeping the connection alive with the SMPP server. The default value is set to 10000 milliseconds (10 seconds). You can adjust this value as per your requirements during the initialization of the VhdSmpp instance.

1.2.2

9 months ago

1.2.1

9 months ago

1.2.0

9 months ago

1.1.0

10 months ago

1.0.0

10 months ago

1.0.9

10 months ago