better-smpp

Migrating from node-smpp

API mapping and behavior changes for existing node-smpp users.

better-smpp is byte-compatible with node-smpp on the wire, so you can migrate one side of a connection at a time. The API is a redesign: Promises instead of callback triples, typed PDUs, and explicit client/server packages.

Client mapping

node-smppbetter-smpp
smpp.connect('smpp://user:pass@host', cb)const client = new SmppClient({ url }); await client.connect()
session.bind_transceiver({...}, cb)await client.bindTransceiver({...}) — throws SmppCommandError on failure
session.submit_sm({...}, cb) + status checkawait client.submitSm({...}) — rejects on non-ESME_ROK
session.on('deliver_sm', pdu => session.send(pdu.response()))client.on("message"/"receipt", …) — acked automatically
auto_enquire_link_periodenquireLink: { intervalMs } — now with dead-link detection
manual session.connect() to reopenreconnect: true — backoff + rebind, lifecycle events
session.on('connect')client.on("connect" / "bound")
pdu.response({...})createResponse(pdu, {...}) or client.respond(pdu, {...})

Server mapping

node-smppbetter-smpp
smpp.createServer(opts, listener)new SmppServer(opts, listener)
server.listen(2775)await server.listen({ port: 2775 })
bind event + pause()/resume() + manual responBind: async (session, pdu) => verdict
session.deliver_sm({...}, cb)await session.deliverSm({...})
{ key, cert } at top leveltls: { key, cert }
enable_proxy_protocol_detection (proxywrap)proxyProtocol: true — native parser
smpp.addCommand / smpp.addTLV (global)new SmppRegistry().registerCommand(...) via the registry option

Field names

Body fields and TLVs are the camelCase form of the spec names — a mechanical rename: source_addrsourceAddr, short_messageshortMessage, esm_classesmClass, command_statuscommandStatus. Command names stay snake_case (submit_sm) as protocol identifiers and event names.

Constants moved from flat exports to namespaced ones:

// before                        // after
smpp.ESME_ROK                    CommandStatus.ESME_ROK
smpp.TON.INTERNATIONAL           TON.INTERNATIONAL
smpp.ENCODING.UCS2               DATA_CODING.UCS2
smpp.consts.REGISTERED_DELIVERY  REGISTERED_DELIVERY

Behavior changes to review

  • TLS certificates are verified by default. node-smpp silently set rejectUnauthorized: false. Pass tls: { rejectUnauthorized: false } explicitly for self-signed peers.
  • Failed requests reject with SmppCommandError (carrying .commandStatus and .response) instead of returning a response object to inspect.
  • Every request times out (default 30 s, configurable per call). node-smpp waited forever and leaked its callback map.
  • submitSm may send several PDUs. Over-length text splits automatically; the result aggregates segment responses. concatenation: false restores send-as-is.
  • deliver_sm is auto-acknowledged around the message/receipt events. Set autoAckDeliverSm: false to respond manually.
  • debug/debugListener are gone — pass logger and metrics hooks instead.

What you get for free

Automatic long-message concatenation and reassembly, structured delivery receipts, send windows, throttle backoff, congestionState tracking, reconnect + rebind, dead-link detection, AbortSignal support, and the full typed v5.0 broadcast family.

On this page