Closed jmercouris closed 7 months ago
I will submit a follow-up pull request where I try to solve this problem, generally.
I am leaning towards solution 1. The reason is because our data is chunked, we don't have an easy way to associate a particular message with a particular recipient.
If we assume messages arrive in order, then the first part of our message could include the recipient ID, but can we assume that? I know we are using TCP, but we are also using multiple threads to send messages. I will think about it.
Thanks for working on this. I understand the limitation of the current implementation. Let's keep this open for now.
I've fixed the generalized problem, and will now update this pull request to use the new technology.
Updated to use new technology! @aadcg !
Will review soon, thanks.
Let me review this PR carefully next Monday and then I'll merge it, thanks.
Thanks @jmercouris.
This allows for execution of arbitrary Lisp on arbitrary events within the JavaScript side.
During this implementation I realized that the
client.on('data...
for all events may be called.How did I realize this?
I noticed that when we have a return value via our
on-event
callback,dispatch-callback
was writing back to the JavaScript side. This resulted in our method inprotocol.lisp
being invoked:We were getting a
client.on('data...
which makes sense. Lisp was writing data using this same socket connection. However we did not want it to be consumed by this particularclient.on('data...
. We perhaps wanted it to be consumed by anotherclient.on('data...
, one dedicated to this event type/object.Therefore I see two primary options.
client.on('data...
that does intelligent routing to the correct function (similar to what we do in Lisp via a hash table).I will think about this and draft an implementation.