diff --git a/packages/bridge/src/msg-push/context.ts b/packages/bridge/src/msg-push/context.ts index 6bde60e0..463fc087 100644 --- a/packages/bridge/src/msg-push/context.ts +++ b/packages/bridge/src/msg-push/context.ts @@ -29,7 +29,12 @@ export interface MsgPushContext { export function buildContext(pkt: PacketInfo, identity: IdentityService): MsgPushContext | null { if (pkt.body.length === 0) return null; - const push = protobuf_decode(Buffer.from(pkt.body)); + // `pkt.body` is already a `Uint8Array` (see `PacketInfo` in + // @snowluma/common/protocol-types). The legacy `Buffer.from(uint8)` + // wrap was a no-op copy — Buffer is a Uint8Array subclass and + // proton's decoder accepts the parent type directly. Dropping the + // wrap saves one allocation per incoming push packet. + const push = protobuf_decode(pkt.body); if (!push?.message) return null; const msg = push.message;