Add event listener support to client
This commit is contained in:
@@ -201,6 +201,10 @@ export class Client implements SmppSession {
|
||||
this.setStatus(ClientStatus.BOUND);
|
||||
}
|
||||
|
||||
on(event: string, callback: (...args: any[]) => void): void {
|
||||
this.eventEmitter.on(event, callback);
|
||||
}
|
||||
|
||||
private connectSession(): void {
|
||||
if (!this.fieldsAreOk()) {
|
||||
return;
|
||||
|
@@ -4,7 +4,7 @@ export interface SmppSession {
|
||||
username: string,
|
||||
password: string,
|
||||
|
||||
sendPdu(pdu: object): Promise<object>;
|
||||
sendPdu(pdu: object, force?: boolean): Promise<object>;
|
||||
|
||||
sendSingle(job: Job): Promise<object>;
|
||||
|
||||
|
@@ -32,7 +32,9 @@ client.connectAndBind().then(() => {
|
||||
source_addr: "1234567890",
|
||||
destination_addr: "1234567890",
|
||||
short_message: "Hello World"
|
||||
}), 100, 100))
|
||||
}), 100, 100));
|
||||
|
||||
client.on(Client.ClientEvents.ANY_PDU, (pdu: any) => console.log(pdu));
|
||||
});
|
||||
|
||||
// class ClientSession {
|
||||
|
Reference in New Issue
Block a user