watson/ipp-printer

Multiple Printers using the same server

Opened this issue · 0 comments

I'm trying to wrap my head around how instantiating multiple printers works. It looks like the functionality is close to existing since you can pass a pre-existing server into the Printer object. The problem is that onrequest is called on the server for every printer which is instantiated

server.on('request', onrequest)
so if I instantiate two printers with a pre-existing server and then send a print job to one of them the onrequest handler gets called twice and then it blows up because it is mutating the req._body field during each call
req._body = ipp.request.decode(req._body)
. Was this not intended to allow multiple printer objects?