MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Specifiche Pagina 274

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 369
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 273
Client-Side Communication ActionScript 83
Compare this data structure to a shared object with the same attributes, but with a flat design that
occupies three slots instead of one:
so.data.year = someValue;
so.data.month = someValue;
so.data.dayOfMonth = someValue;
In this case, because each slot contains only one piece of information, less bandwidth is required
to update all connected clients when a single data attribute is changed.
You can use this information when designing your remote shared objects. For example, if an
object is designed to be updated frequently by multiple clients in real time, minimizing the
amount of data per slot can improve performance. This design can also help minimize data
collisions (multiple clients trying to change a single slot at the same time).
Conflict resolution
If more than one client (or a server application) can change the data in a single slot of your
shared object at the same time, you must implement a conflict resolution strategy. Here are
some examples:
Use different slots The simplest strategy is to use a different slot for each player or server that
might change data in the object. For example, in a shared object that keeps track of users in a chat
room, provide one slot per user and have users modify only their own slots.
Assign an owner A more sophisticated strategy is to define a single client as the owner of a
property in a shared object for a limited period of time. You might write server code to create a
“lock” object, where a client can request ownership of a slot. If the server reports that the
request was successful, the client knows that it will be the only client changing the data in the
shared object.
Notify the client When the server rejects a client-requested change to a property of the shared
object, the
SharedObject.onSync event handler notifies the client that the change was rejected.
Thus, an application can provide a user interface to let a user resolve the conflict. This technique
works best if data is changed infrequently, as in a shared address book. If a synchronization
conflict occurs, the user can decide whether to accept or reject the change.
Accept some changes and reject others Some applications can accept changes on a “first come,
first served” basis. This works best when users can resolve conflicts by reapplying a change if
someone elses change preceded theirs.
Local disk space considerations
You can choose to make remote shared objects persistent on the client, the server, or both. (Local
shared objects are always persistent on the client, up to available memory and disk space.)
Vedere la pagina 273
1 2 ... 269 270 271 272 273 274 275 276 277 278 279 ... 368 369

Commenti su questo manuale

Nessun commento