Repository navigation
TypeScript Definitions Added
Preamble
Now this isn't the full story
It was attempted to ship version 1.4.4 and then it had an issue then 1.4.41 and it had some bugs and then 1.4.45 which was temporary since all identified bugs weren't solved yet (yes, it took a month later to reach here)
Before the talk about the bugs in 1.4.45 begins, let's first discuss what 1.4.4 on the whole brought
1.4.4
Pinging logic in this package has changed and depending more on this rfc
It was an interesting road to go down, looking back at the pinging mechanism in this repository, and realising that while the application level of ping "awareness" is especially useful on the browser, there can be an interesting balance brought about by letting the server do the actual rfc ping and then sending normal traffic that the client can see to know the connection is still valid on its end as well
Why all this gymnastics? Well if the browser is handling a lot, application level pinging will hang (but the rfc ping gets responded to!). So this is basically an attempt to disconnect a sticking client from its belief that the server is no longer connected (when this issue was observed, it ended up in reconnect spam)
1.4.45
With 1.4.45 there were 2 very interesting bugs left
- One was where
if(item===null || otherstuffhere)was not evaluating when item was literally null and it was solved by good old bracketsif(item===null || (otherstuffhere)). This bug used to sendnullyet send it in the form of a special datatype (as undefined) - The other was where modifying the clone on an object's deletion was not enough, recursive modification of the referential map was required as well. Therefore, when an object is no longer existing in a certain path, the count of how many times it is existing in the object overall loses a count of 1 (one less place where the object exists). If that number drops to 0, the map record of that original object is deleted. This condition can happen anywhere in the object so this logic has to be recursively enforced, thus the
recursivelyDetachfunction added in the serialisation script. This bug used to handle references incorrectly (thinking they still existed in the main object) which led to erroneous stringification since it would try to show the difference of the object as though it was still there and never edited
Conclusion
Keeping inventory of a tree structure of unknown depth, each node with an unknown amount of children that can be a plethora of types, and sending the necessary data over a websocket such that the state of that tree is maintained over clients across the internet, is difficult, but the light at the end of the tunnel is seen 🥳
next update: support for Date instances FINALLY