Search code examples
javascriptnode.jssocket.iosails.jsmultiplayer

how to use sails.js and socket.io for online game server-side


I'm trying to create an online multiplayer game. After some digging, I came up with sails and socketio.
The server needs to be real-time. I want to use the sails as my data controller(like player authentication), and the socketio for real-time connection.

Questions:
1. Is sails able to integrate with socketio?
2. If so, Can I connect to socket.io with a connection from my game? (NO Javascipts in client side), and how?
3. Is there something I'm missing? any other options?


EDIT:
1. how can I use sails as my authentication system for online players and socket.io as my real-time connection?
5. The connection must be TCP or UDP or I should use HTTP?

Does anyone have any experience in online gaming? please give me hint where to start and what to use for a multiplayer online game like MOBA games?

Thanks.


Solution

    1. Sails works great with Socket.io and there are plenty of tuts on it. Here is some documentation to get you started. https://github.com/balderdashy/sails-docs/blob/0.9/sockets.md
    2. You could, but that will depend on how you communicate with the server. The docs should steer you to your solution. Sorry I can't elaborate on this as I'm not a game dev, but I do use Socket.io in application development.
    3. Maybe you could check out something like Firebase as well?