— i've been following your work for some time now, and your example really inspired me a lot to start digging deeper in Construct and multiplayer stuff.
I'm a kinda self-taught guy with highschool/college/bussines experience in bunch of different languages (starting in '97 with some good 'ole qbasic and GOTO 10, GOTO 20 stuff), but javascript and node really got my boner up, if you now what i mean, so take my words with a grain of salt.
So, after reading some of your code on server example, and zack's socket.io plugin and some hacking with it i realized that if we have just a "send" action which calls Socket.send(data), server will always be a giant if loop, and we'll check messages by splitting received data first, then checking how the first part of your message looks like, and i believe it's not really node-ish to do, because when you start writing some bigger pieces your server code is a giant if(like this sentence), which is constantly evaluated and eventually will be slow(er) and hard to understand.
So i added a "emit" action to the plugin you can emit a custom event to the server. In C2 it is similar to "send", but besides your message, you have to tell it what event are you emitting. Plugin now uses socket.emit('yourevent',"yourdata").
Now server can, instead of looking like this:
socket.on("message", function (data) {
var new_data = data.split(',');
if (new_data[0] == 'P') {do something}
else if (new_data[0] == 'D') {do this}
else if (new_data[0] == 'L') {do that}
etc...
look like
socket.on("message", function (data) {
var new_data = data.split(',');
etc
}
socket.on("yourevent", function (data) {
var new_data = data.split(',');
etc
}
and I believe it's much more elegant.
I planned to post my plugin now, but i've found out you released an updated version few days ago so i'll incorporate my edits to your latest version, and put it here so you can check the code and see have i fucked up anywhere.
I also started to hack the plugin so you can trigger custom events inside the plugin (so that server can emit custom events to client), but thats a work in progress.
itza3985: Actually all this motivation for adding emit function is because we're currently working on something similar to your idea. (By we i mean group of 4 people working on this for last 3 months)
Whole system is made with idea that is reusable for different kind of games, so everyone will be able to connect to our server and implement joystick functionality to your C2 projects. Server is currently hosted on nodejitsu, in my opinion the best Paas currently online (give them a click: http://nodejitsu.com/
I hope to share a demo with you within next 3 weeks (it's online, but we won't share it until it's on some decent level)
Taurian with "emit" action you'll be able to utilize the room thingy(although you can do it now with "send" also), but it's something you'll have to do on server side, if i'm wrong somebody correct me, give me some guidance and i'll try to incorporate it in the plugin
Whoa, enough for now, wrote too much, will report soon with edited plugin and more info on the joystick thingy.
P.s Has anyone looked into the whole "Socket.io plugin won't minify" thing? In my opinion it's really important to have that problem solved, after i'm done with "emit" thing i'll try put my focus on that!