I develop a browser based game with node.js in back and HTML5 canvas in front-end. It use WebSockets for communication.
My plan is to generate business events in client side, e.g.: "finishJob". Client will store all relevant information up to date.
- client doesn't have to call server every time it need some data e.g: players money
- to achieve this, client will subscribe to players channel
- every online player has its own channel, like a chat room
- every time something happen with a player, its channel fire an event with players new data
In MVC pattern in here the model is Player, the View is the HTML5 Canvas, but i need 2 type of controllers:
- controller to handle business events
- controller to handle channels and subscribers
My questions: Is this a viable option? If yes, are there any design pattern similar for this, or any article about this kind of architecture? Are there any naming conventions ("controllers", "handlers", "channels"...)?