Larv IT SMPP
This is a simplified implementation of the SMPP protocol.
Installation
npm install larvitsmpp
Client
Simplest possible
This will setup a client that connects to localhost, port 2775 without username or password and send a message.
var larvitsmpp = ; larvitsmpp;
Some connection parameters and DLR
This will setup a client that connects to given host, port with username and password, send a password and retrieve a DLR.
larvitsmpp;
Server
Simplest possible
This will setup a password less server on localhost, port 2775 and console.log() incomming commands.
var larvitsmpp = ; larvitsmpp;
With auth, returning smsId and DLR
Example code below:
// This should of course be replaced with your preferred auth system { if username === 'foo' && password === 'bar' // The last parameter is just user meta data that will be attached to the session as "userData" and is optional ; else ; } larvitsmpp;
Session Events
connect
Triggered when the socket is connected to a client. This is server specific.
data
Triggered when data is comming in on the socket.
close
Triggered when the socket is closed.
error
Generic error event.
sms
Incoming SMS.
incomingPdu
Incoming PDU.
incomingPduObj
Incoming PDU Object. Same as incomingPdu, but it have been converted into an object instead of a buffer.
Session commands
send
Send a PDU to the remote.