dsriseah / ursys

an opinionated javascript library for prototyping realtime web apps
1 stars 2 forks source link

Code Refactoring Opportunities #12

Closed dsriseah closed 4 months ago

dsriseah commented 6 months ago

This is a tracking issue to note what opportunities I see for clarifying convoluted modules. In each comment, I'll note any commits that address them.

dsriseah commented 6 months ago

URNET.Endpoint Class

This is a complicated class that encapsulated the URNET message systems in a network technology-agnostic way. Conceptually, the Endpoint class is capable of sending and receiving URNET.NetPacket objects (messages) through URNET.NetSockets (connection objects with send(), close(), and onData() messages).

A challenge is that Endpoint can work both as a client or server endpoint. As a client endpoint, it connects to a gateway. As a server endpoint, it listens for connections and manages clients. The main processing logic is slightly different depending on how the Endpoint is invoked:

CLEANUP

Resolved as part of ursys-auth 3fd499416