Closed fengb closed 2 years ago
Minor disadvantage:
try
... which is basically a callback. But at least the function context is controlled.Disadvantage averted:
recvEvent()
to be more resource like. Now it holds onto a "lock" that needs to be deinitted, where attempting to recv multiple consecutive events crash spectacularly. This should hopefully be a lot more obvious that it cannot be done, instead of being a UB footgun.
Advantages:
Client.init()
captures only the auth,startGateway()
stores the connection info (instead of awkwardly sticking it onto the client)Disadvantages:
ws.recvEvent()
is horribly non-concurrent — this was the main reason I preferred callbacks since it controlled the event lifecycle