mixer / carina

Easy to use library for connecting to and using Mixer's Constellation
MIT License
10 stars 3 forks source link

Simplify and solidify subscriptions, allow multiple listeners #15

Closed connor4312 closed 7 years ago

connor4312 commented 7 years ago

The Carina socket was based around the socket in beam-client-node. The node client was built around the idea that individual RPC calls (chat messages) are important to send, but this doesn't really matter for Carina, and in fact the queuing to make sure that every call went out actually has lead to some weird bugs/edge cases. Rather, Carina's use case is oriented around tying state to one socket session.

In this PR, I've simplified things a bit. I've exorcised the queue from the socket -- packets can only be sent while the socket is open, otherwise they'll fail. We have Subscription objects that track the state and add themselves to new sockets. This also adds a little feature that lets you add and remove multiple listeners, where previously remove() would remove all listeners for an event.

No breaking changes.

connor4312 commented 7 years ago

Oh, also, relevant card: https://trello.com/c/PWzLTP95/34-packet-was-cancelled-or-carina-was-closed-noisy-console-error

Pretty sure the issue was that we weren't halting pings when the socket closed