Client
Overview
SmppClient — the fully-typed SMPP ESME.
SmppClient from @better-smpp/client is the ESME side of SMPP: it connects to an
SMSC, binds, submits messages and receives deliveries. Every operation is
Promise-based; every unsolicited PDU arrives through a typed event.
import { SmppClient } from "@better-smpp/client";
const client = new SmppClient({
url: "smpp://systemId:password@smsc.example.com:2775",
});
await client.connect();
await client.bindTransceiver();Options
| Option | Default | Description |
|---|---|---|
url | — | smpp://[systemId:password@]host[:port], or ssmpp:// for TLS |
host / port | localhost / 2775 (3550 TLS) | Discrete target; overrides URL parts |
tls | off | true or node:tls connect options. Certificates verified by default |
connectTimeoutMs | 30000 | TCP/TLS connect timeout |
requestTimeoutMs | 30000 | Default response timeout per request |
enquireLink | off | Keepalive: interval ms, or { intervalMs, timeoutMs, maxMissed } |
windowSize | unlimited | Max outstanding un-acked requests; overflow queues FIFO |
windowQueueLimit | unlimited | Queue length beyond the window before failing fast |
concatenation | { method: "udh" } | Long-message auto-split; { method: "sar" } or false |
throttle | on | Backoff retry on ESME_RTHROTTLED / ESME_RMSGQFUL; false disables |
reconnect | off | true or { maxRetries, baseDelayMs, maxDelayMs, rebind } |
autoAckDeliverSm | true | Answer deliver_sm automatically after events fire |
systemId, password, systemType, interfaceVersion, addrTon, addrNpi, addressRange | — | Bind defaults |
registry | standard | SmppRegistry with custom commands/TLVs |
defaultEncoding | "ASCII" | Text encoding used for dataCoding 0 |
maxPduLength | 16384 | Upper bound on accepted/produced PDU size |
logger / metrics | no-op | Observability hooks |
Operations
| Method | Returns |
|---|---|
connect() | resolves when the transport is ready |
bindTransmitter/bindReceiver/bindTransceiver(params?) | the bind response |
submitSm(params) | SubmitResult (auto-split aware) |
dataSm(params) | data_sm_resp |
querySm(params) | query_sm_resp |
cancelSm(params) / replaceSm(params) | void |
respond(pdu, fields?) | sends the matching _resp |
unbind() | performs the unbind handshake |
close() / destroy() | graceful / immediate teardown |
All request operations take { timeoutMs, signal } as an optional second argument.
Events
| Event | Payload | When |
|---|---|---|
connect | — | transport established (before bind) |
bound | SessionState | a bind completed |
unbound | — | unbind handshake done |
message | AssembledMessage | complete inbound message (multipart already joined) |
receipt | DeliveryReceipt, pdu | parsed delivery receipt |
deliver_sm | decoded PDU | every raw deliver_sm |
alert_notification / outbind | decoded PDU | SMSC-initiated PDUs |
throttled | status, delayMs | a submit hit throttling; retrying |
congestion | 0–100 | SMSC reported congestionState |
reconnecting / reconnected | attempt info / — | reconnect lifecycle |
pdu / unknownPdu | decoded PDU | observability firehose |
error / close | Error / — | transport lifecycle |