Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
update server.deliverMessage to match new signature
Browse files Browse the repository at this point in the history
  • Loading branch information
bjyoungblood committed Dec 14, 2011
1 parent c807da1 commit 10b885c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ exports.server = function(config) {
/*
* Used as a hook to deliver inbound messages to a client
*/
self.deliverMessage = function(system_id, sender, recipient, message) {
self.deliverMessage = function(system_id, params, optional_params) {
var id, key;

for (key in self.clients) {
// IMPORTANT: if two clients are connected with the same system id, the message
// will TYPICALLY be delivered to the least-recently connected (but not always!)
if (self.clients[key].system_id === system_id) {
id = self.clients[key].deliverMessage(sender, recipient, message);
id = self.clients[key].deliverMessage(params, optional_params);
if (id !== false) {
return id;
}
Expand Down
7 changes: 6 additions & 1 deletion server-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ process.stdin.on('data', function(chunk) {
message += parts[i] + " ";
}

id = shortyServer.deliverMessage('SHORTY', parts[0], parts[1], message);
id = shortyServer.deliverMessage('SMSCLOUD', {
'source_addr': parts[0],
'destination_addr': parts[1],
'sm_length': Buffer.byteLength(message),
'short_message': new Buffer(message)
});
});

var sighandle = function() {
Expand Down

0 comments on commit 10b885c

Please sign in to comment.