What is it?
SSMMS is a lightweight library to create and join rooms, and, to send messages in them.
SSMMS is built on top of NodeJS, Express and Socket.io, the whole thing is then hosted on a Heroku Dyno.
How do I use it?
Usage is very simple, include the library in your index.html file like so:
Then initialise the library by calling the SSMMS constructor, specifying whether you want to log debug messages on the console:
var server = SSMMS(debug);
then initiate a connection passing your server:
Is that it?
While this is enough to get a connection going, you may want to setup your handlers for the various events that happen:
Error codes are of two types:
CNC for could not connect errors
CNJ for could not join errors
Creates a room called name on the server, accepting a maximum of maxPlayers players in it.
Requests a list of the rooms on the server, on receiving it, the onRoomsReceivedHandler method is called.
Joins the room called name on the server, if the room exists and it’s not full.
Joins the first empty room on the server.
Un-joins the room with the specified name, if it was joined before.
Broadcasts a message to all players in the same room, the message sent specifies a type and a message body.
If you feel like helping me out, feel free to make a donation to support development, any amount is appreciated :)