lundi 2 février 2015

Multi Room Chatroom Architecture


I'm building a multi room chatroom app, with some extra features that go beyond a few methods/calls.


I'm wondering if I should:


Manually create every method call on the clients and servers, which feels like it results in a fair amount boilerplate code. (I have not added significant authentication and authorization yet, so perhaps that will feel less bad as time goes on)


Alternatively, I could have some fairly generic methods that let you pass parameters into objects from the client, that are just thrown back to the destinations, which then decide what actions to take. IE you could sendMessage to the server, which then just fires that message to where it's supposed to go, and the clients then look inside the message to decide what to do to it.


Perhaps it could be a combined approach, with a set of generic methods for getting stuff done quickly, but then not being afraid to spin out to other methods when needed.


Currently I'm avoiding the generic methods idea, but it does feel like that would work in a lot of cases that I'm coming across.


I'm building this with Socket.IO, but I assume this question is relevant to any client server event system.





Aucun commentaire:

Enregistrer un commentaire