Lapo wrote:SendObject is mainly a client-side way of broadcasting data to other people. From server side it isn't particularly useful, you easily replace it with your own extension call that does exactly what you want.
cheers
Are you suggesting that the most efficient way to broadcast a leaderboard update intermittently is to put a call to sfsApi.sendExtensionResponse in a for loop for all room users?
Psedocode...
for (each user)
sfsApi.sendExtensionResponse("lb", leaderboardObj, user, currentRoom, false);
I disagree, send object message is perfectly useful from serverside... I use it everywhere in my extensions. Each object message is assigned a ID "t" for Type which the client uses to recognize what the purpose of each object is.
Code: Select all
//Object message type
newParams.putByte("t",(byte) 9);
mmoApi.sendObjectMessage(mapRoom,Reporter,newParams,mapAoi);
As security against cheating... I even make it so that object messages that go from one client to other clients are initially sent from the client as a extension request, then assigned their purpose, then sent to other clients as an object message from serverside.
That way, I can build out my cheat detection and prevention system easily as needed. Verifying that players are near where their projectile is supposed to come from, and that players that are getting attacked are reporting they are getting attacked enough, etc...