Skip to content

Commit

Permalink
feat: notify listeners for each outgoing packet
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Mar 29, 2022
1 parent a7f1c90 commit 38ee887
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ export class Adapter extends EventEmitter {
const encodedPackets = this.encoder.encode(packet);

this.apply(opts, socket => {
if (typeof socket.notifyOutgoingListeners === "function") {
socket.notifyOutgoingListeners(packet);
}

socket.client.writeToEngine(encodedPackets, packetOpts);
});
}
Expand Down Expand Up @@ -192,6 +196,10 @@ export class Adapter extends EventEmitter {
// call the ack callback for each client response
socket.acks.set(packet.id, ack);

if (typeof socket.notifyOutgoingListeners === "function") {
socket.notifyOutgoingListeners(packet);
}

socket.client.writeToEngine(encodedPackets, packetOpts);
});

Expand Down

0 comments on commit 38ee887

Please sign in to comment.