Issue:
When more than one message received, only the oldest one will always be handled, then buffer.replace(message + this.delimiter, '') will remove it. When a new message arrives, the second oldest one will be handled so one message will always be delayed.
Solution:
Changed messages to array and handled it as a queue
Issue: When more than one message received, only the oldest one will always be handled, then
buffer.replace(message + this.delimiter, '')
will remove it. When a new message arrives, the second oldest one will be handled so one message will always be delayed.Solution: Changed messages to array and handled it as a queue