Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: buffer messages from external resource #582

Merged
merged 3 commits into from
May 2, 2024

Conversation

nicomoya123
Copy link
Contributor

  • When setting the to messageEventName: 'messageBuffer', the channel is received as buffer. I have added a check to set it as such.
  • The buffer is also serialized as json when so I have checked if it as a buffer and return it as it is.
    תודה !

@ujwal-setlur
Copy link

I just ran into it as well. I was about open a PR :-). Thanks @nicomoya123. Any chance this can get merged soon? It has been open for a long time.

? this.deserializer(message, { pattern, channel })
: JSON.parse(message, this.reviver);
if(this.deserializer){
parsedMessage = this.deserializer(Buffer.from(message), { pattern, channel })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serializer/deserializer may not be dealing with buffers at all. I think the original code is correct. I think the only change needed is the check above for whether channel is an object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might not remember correctly, but I think this is when you set it using the config. Do you have a test case where this is incorrect?

Copy link

@ujwal-setlur ujwal-setlur Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are some serialization/deserialization libraries that don't necessarily output buffers or take in buffers. They could be encoding/decoding using strings (inefficient, I know). But then, I guess they would not be setting the eventName to messageBuffer in the config. So this is likely ok.

@nicomoya123
Copy link
Contributor Author

@davidyaha can this be merged ?

@davidyaha davidyaha merged commit 938fc71 into davidyaha:master May 2, 2024
1 check failed
@davidyaha
Copy link
Owner

Thanks @nicomoya123 and sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants