Bumped upstream versions, minor adjustments to docs and a log message
This commit is contained in:
@@ -4,20 +4,20 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"global-strict": [2, "always"],
|
"strict": [2, "safe"],
|
||||||
"no-mixed-requires": false,
|
"no-mixed-requires": 0,
|
||||||
"no-multi-spaces": false,
|
"no-multi-spaces": 0,
|
||||||
"space-infix-ops": true,
|
"space-infix-ops": 2,
|
||||||
"quotes": [1, "single"],
|
"quotes": [1, "single"],
|
||||||
"vars-on-top": [1, true],
|
"vars-on-top": 1,
|
||||||
"one-var": [1, true],
|
"one-var": 1,
|
||||||
"no-shadow": false,
|
"no-shadow": 0,
|
||||||
"eol-last": false,
|
"eol-last": 0,
|
||||||
"key-spacing": false,
|
"key-spacing": 0,
|
||||||
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
|
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
|
||||||
"space-unary-ops": [1, { "words": true, "nonwords": true }],
|
"space-unary-ops": [1, { "words": true, "nonwords": true }],
|
||||||
"no-underscore-dangle": false,
|
"no-underscore-dangle": 0,
|
||||||
"camelcase": false,
|
"camelcase": 0,
|
||||||
"no-process-exit": false
|
"no-process-exit": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,9 +11,10 @@ This is a simplified implementation of the SMPP protocol.
|
|||||||
|
|
||||||
This will setup a client that connects to localhost, port 2775 without username or password and send a message.
|
This will setup a client that connects to localhost, port 2775 without username or password and send a message.
|
||||||
|
|
||||||
var larvitsmpp = require('larvitsmpp');
|
```javascript
|
||||||
|
var larvitsmpp = require('larvitsmpp');
|
||||||
|
|
||||||
larvitsmpp.client(function(err, clientSession) {
|
larvitsmpp.client(function(err, clientSession) {
|
||||||
clientSession.sendSms({
|
clientSession.sendSms({
|
||||||
'from': '46701113311',
|
'from': '46701113311',
|
||||||
'to': '46709771337',
|
'to': '46709771337',
|
||||||
@@ -22,18 +23,20 @@ This will setup a client that connects to localhost, port 2775 without username
|
|||||||
|
|
||||||
// Gracefully close connection
|
// Gracefully close connection
|
||||||
clientSession.unbind();
|
clientSession.unbind();
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
||||||
### Some connection parameters and DLR
|
### 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.
|
This will setup a client that connects to given host, port with username and password, send a password and retrieve a DLR.
|
||||||
|
|
||||||
larvitsmpp.client({
|
```javascript
|
||||||
|
larvitsmpp.client({
|
||||||
'host': 'smpp.somewhere.com',
|
'host': 'smpp.somewhere.com',
|
||||||
'port': 2775,
|
'port': 2775,
|
||||||
'username': 'foo',
|
'username': 'foo',
|
||||||
'password': 'bar'
|
'password': 'bar'
|
||||||
}, function(err, clientSession) {
|
}, function(err, clientSession) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -63,7 +66,8 @@ This will setup a client that connects to given host, port with username and pas
|
|||||||
// Gracefully close connection
|
// Gracefully close connection
|
||||||
clientSession.unbind();
|
clientSession.unbind();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Server
|
## Server
|
||||||
|
|
||||||
@@ -71,9 +75,10 @@ This will setup a client that connects to given host, port with username and pas
|
|||||||
|
|
||||||
This will setup a password less server on localhost, port 2775 and console.log() incomming commands.
|
This will setup a password less server on localhost, port 2775 and console.log() incomming commands.
|
||||||
|
|
||||||
var larvitsmpp = require('larvitsmpp');
|
```javascript
|
||||||
|
var larvitsmpp = require('larvitsmpp');
|
||||||
|
|
||||||
larvitsmpp.server(function(err, serverSession) {
|
larvitsmpp.server(function(err, serverSession) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -81,25 +86,27 @@ This will setup a password less server on localhost, port 2775 and console.log()
|
|||||||
serverSession.on('data', function(data) {
|
serverSession.on('data', function(data) {
|
||||||
console.log('command: ' + data.command);
|
console.log('command: ' + data.command);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
||||||
### With auth, returning smsId and DLR
|
### With auth, returning smsId and DLR
|
||||||
|
|
||||||
Example code below:
|
Example code below:
|
||||||
|
|
||||||
// This should of course be replaced with your preferred auth system
|
```javascript
|
||||||
function checkuserpass(username, password, callback) {
|
// This should of course be replaced with your preferred auth system
|
||||||
|
function checkuserpass(username, password, callback) {
|
||||||
if (username === 'foo' && password === 'bar') {
|
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
|
// The last parameter is just user meta data that will be attached to the session as "userData" and is optional
|
||||||
callback(null, true, {'username': 'foo', 'userId': 123});
|
callback(null, true, {'username': 'foo', 'userId': 123});
|
||||||
} else {
|
} else {
|
||||||
callback(null, false);
|
callback(null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
larvitsmpp.server({
|
larvitsmpp.server({
|
||||||
'checkuserpass': checkuserpass
|
'checkuserpass': checkuserpass
|
||||||
}, function(err, serverSession) {
|
}, function(err, serverSession) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -128,7 +135,8 @@ Example code below:
|
|||||||
//serverSession.sendDlr(sms, false);
|
//serverSession.sendDlr(sms, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Session Events
|
## Session Events
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -198,7 +198,7 @@ function send(pdu, closeAfterSend, callback) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = new Error('Event triggered but incoming PDU is not a response or seqNr does not match. isResp: ' + incPduObj.isResp().toString() + ' incSeqNr: ' + incPduObj.seqNr + ' expected seqNr: ' + pduObj.seqNr);
|
err = new Error('Event triggered but incoming PDU is not a response or seqNr does not match. isResp: ' + incPduObj.isResp().toString() + ' incSeqNr: ' + incPduObj.seqNr + ' expected seqNr: ' + pduObj.seqNr);
|
||||||
log.warn(err.message);
|
log.warn('larvitsmpp: lib/session.js: send() - this.on(incomingPduObj) - ' + err.message);
|
||||||
callback(err);
|
callback(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+4
-4
@@ -9,16 +9,16 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^1.5.2",
|
"async": "^1.5.2",
|
||||||
"iconv-lite": "^0.4.13",
|
"iconv-lite": "^0.4.13",
|
||||||
"moment": "^2.11.2",
|
"moment": "^2.13.0",
|
||||||
"utils-merge": "^1.0.0",
|
"utils-merge": "^1.0.0",
|
||||||
"winston": "^2.1.1"
|
"winston": "^2.2.0"
|
||||||
},
|
},
|
||||||
"description": "Simplified SMPP implementation",
|
"description": "Simplified SMPP implementation",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^2.11.9",
|
"coveralls": "^2.11.9",
|
||||||
"istanbul": "^0.4.3",
|
"istanbul": "^0.4.3",
|
||||||
"mocha": "^2.4.5",
|
"mocha": "^2.4.5",
|
||||||
"portfinder": "^0.4.0"
|
"portfinder": "^1.0.3"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"smpp",
|
"smpp",
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"url": "https://github.com/larvit/larvitsmpp",
|
"url": "https://github.com/larvit/larvitsmpp",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
},
|
},
|
||||||
"version": "0.1.18",
|
"version": "0.1.19",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/larvit/larvitsmpp/issues"
|
"url": "https://github.com/larvit/larvitsmpp/issues"
|
||||||
|
|||||||
Reference in New Issue
Block a user