question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hi how can i find username off client on submit_sm in server ? i want have multi client

session.on("submit_sm", function (pdu) {

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ritmascommented, Jun 7, 2018

As long as session is unique per client-server communication, try this workaround:

var smpp = require('smpp');
var server = smpp.createServer(function(session) {
    if (typeof session.client !== 'undefined') {
        session.send(pdu.response({
            command_status: smpp.ESME_RBINDFAIL
        }));
        session.close();
        throw Error('Session already has "client" key');
    }
    // introduce new session var
    session['client'] = {
        system_id: ''
    };
    session.on('submit_sm', function(pdu) {
        console.log('client username is : ', session.client.system_id);
    });
    session.on('bind_transceiver', function(pdu) {
        // we pause the session to prevent further incoming pdu events,
        // untill we authorize the session with some async operation.
        session.pause();
        checkAsyncUserPass(pdu.system_id, pdu.password, function(err) {
            if (err) {
                session.send(pdu.response({
                    command_status: smpp.ESME_RBINDFAIL
                }));
                session.close();
                return;
            }
            // set client ID/username
            session.client.system_id = pdu.system_id;
            session.send(pdu.response());
            session.resume();
        });
    });
});
server.listen(2775);
0reactions
parsiboxcommented, Jun 7, 2018

it work thank you so much

Read more comments on GitHub >

github_iconTop Results From Across the Web

MULTI-CLIENT definition | Cambridge English Dictionary
involving several clients (= customers who receive a service): He works at the company's multi-client logistics center. The company provides ...
Read more >
Multiclient Definition & Meaning - Merriam-Webster
The meaning of MULTICLIENT is having or involving more than one client. How to use multiclient in a sentence.
Read more >
Multi-Client Data Definition | Law Insider
Multi -Client Data means any rights (including ownership or licensing) to seismic data surveys worldwide (other than Brazil) and related data collected, ...
Read more >
What is a Multi-Client Warehouse? Logistics Glossary - Penske
A multi-client warehouse is a warehouse that is shared by multiple clients, allowing shippers to tailor warehouse capacity to shifts in operational demands ......
Read more >
Multi-client observe window in Remote Desktop - Apple Support
Multi -client observe window in Remote Desktop. When you observe many clients at the same time, they all appear in the same observe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found