jhead / node-svmq

Native System V message queues in Node.js
MIT License
19 stars 10 forks source link

receive mtype value with on data callback #3

Open kikolehm opened 7 years ago

kikolehm commented 7 years ago

Hi,

First of all thanks for the intresting project. One missing thing I have noticed is that mtype value is not provided on data event. It would be really useful to also know what was message type.

jhead commented 7 years ago

Hi @kikolehm, good suggestion. It will require some changes to the ReceiveMessageWorker in the native code to pass back either a JS object containing both mtext and mtype or a third callback parameter (err, mtext, mtype). From there, the JS data event can be modified to pass back an object:

{
  data: Buffer,
  type: Number
}

I'm open to pull requests if you have time to work on this yourself. Otherwise, I'll try to look into it over the next couple of weeks, but no promises.