In a Phoenix-based project, it is rather tedious to get a raw cowboy websocket working manually, as one is required to set-up a custom dispatch as well as to handle the socket itself. Therefore, after a few hours of testing and reading through the source code, I have come up with a solution that follows Phoenix’ semantics nicely.
I think handle suits better as a generic name, as it does receive both incoming data and a few events. Plus switching to _in would only make sense if there was an _out counterpart, which is not the case.
Would like to hear more comments on this
On events (i.e. :closed), I thought adding a separate callback for them would be a bit overkill - which is why they’re dispatched through the same generic callback, what do you think?