Daxbot / sockhop

1 stars 1 forks source link

Socket symmetry #7

Open jonathanvanschenck opened 2 years ago

jonathanvanschenck commented 2 years ago

Right now, the socket's which get tracked by the server are just raw net Socket instances, while on the client, we get the nice wrapping with the ATCPClient class. It would be nice if one of three things happened: 1) the ATCPClient was changed to become a superset of the net socket (right now, methods like "end" and "disconnect" aren't consistent with the builtin net package) 2) the sockets tracked by the server were wrapped in something like the ATCPClient, so that they had the same interface as the clients 3) Both the ATCPClient and the server-side sockets were wrapped -- this one is probably my favorite, because then we can move the session into the server-side socket's wrapper, which cleans up the code base, and makes interactions with the end-user a little nicer.

jonathanvanschenck commented 2 years ago

Possibly for a 2.0.0 release?

jonathanvanschenck commented 2 years ago

Also, with the addition of SockhopSessions, we are moving away from using raw sockets anyway. However, keeping track of pings and response promises is a bit weird, and it would be nice to attach these to the socket somehow (since they aren't really intended for the end-user to interact with, they don't really belong in the Sesison)

jonathanvanschenck commented 2 years ago

Well, it would also be nice if the session were also the things that emitted the received/request events too -- that way someone can work directly with the sessions and never have to deal with the server directly