After working with Twitter Flight on a recent project, I really enjoyed getting to grips with its event based design. I often found coaxing a UI's features into these events sometimes confusing, but in the end it was a refreshing way to look at the development of a UI.
This lead me to think about whether this event-driven design could be applied to the back end as well as the front. I've put together a super simple example using Node.js, Socket.IO and Twitter Flight to try and explore this idea. If I have chance to further this idea, I would like to explore adding authentication, a better fallback for browsers that dont support web sockets than long polling and some form of white listing or namespacing events that should be sent/recieved to the back end.
I understand sockets are probably not the best transport to replace traditional REST api calls. But, it can at least be used for non-critical calls that may have been done through sockets anyway.
Eventually, it would be great if this could rid the need for data components in Twitter Flight, as the server will be listening to all of the relevant events triggered from the UI components. It can simply respond with the appropriate data though a socket.
The repository is available here: https://github.com/chrishale/socketapio
If anyone sees any future in this possible design pattern or can see any fundimental flaws — let me know below. Thanks!