You can pass client/socket object and whatever else you need to different files. I see no problem with that. Also, socket.io supports namespaces exactly for this kind of things.
PS: another good solution would be to forget about MVC forever ;) On Sunday, June 30, 2013 8:50:29 AM UTC+4, Mike Chen wrote: > > Hi guys, > > I'm pretty new to Node.JS and socket IO, so I was wondering if I could get > some guidance on project I'm working on. I would like to build a single > page multiplayer game that basically communicates solely through socket.IO. > > However, I am quickly seeing that my socket.js file is getting very > clumsy. I am using express to manage the MVC side of things, but I feel > like socket connections don't really fit in the MVC paradigm. > > I have read a bunch of tutorials on node JS and socket IO, but all of them > have small socket components. > > Essentially I am wondering how to break down a large socket.js file into > smaller more manageable components? For example, I have a chat room in the > page, as well as the game part, and some meta game aspects. I don't feel > like these all belong in the same socket.js file, but it doesnt seem clean > to divide them in separate files either because you need access to the > client and the socket object ( to emit to all users in a room lets say) > > Thanks > > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.