HTML and CSS Reference
In-Depth Information
The Basic Architecture of an ElectroServer Application
ElectroServer acts very much like the socket-server application we described in the previous
section. It listens on specified ports for different protocols; when messages arrive, they are
routed back to the connected clients.
However,ElectroServerhassomespecificfeaturesthatweshoulddiscuss.Someoftheseexist
on other socket-server platforms, while some don't. However, much of this discussion will
still be applicable to other socket servers when they make JavaScript APIs available.
Client
The client for an ElectroServer application is a program written in one of the API-supported
language platforms, including Flash ActionScript 2, Flash ActionScript 3, Java, Objective-C,
C#/.NET, and now JavaScript. The client is the application, which the user will manipulate to
sendmessagesthroughtheAPItoElectroServer.Thisisusuallyagame,achatroom,avirtual
world, or some other kind of multiuser social or communication application.
All the communication with ElectroServer is event -based. The client application uses the
JavaScript API to send events, and the client defines event handlers that listen for messages
from ElectroServer. All of these messages and events are communicated through the API,
which in turn is communicating through port 8989 using the BinaryHTTP protocol (at least
for our examples).
Zones, rooms, and games
WhenauserfirstconnectstoElectroServer,sheneedstojoinorcreatea zone ,whichissimply
a collection of rooms. If the user tries to create a zone that already exists, she will be added to
that zone without creating a new one.
After entering a zone, the user needs to join a room in that zone. If a user attempts to create a
new room that already exists, she will be added to that room instead.
NOTE
Beyond zones and rooms, ElectroServer also offers a GameManager API that allows you to further
segment users into specific instances of a game that is being played. We do not get this granular for
the examples in this chapter.
Extensions
Extensions are server-side code modules that can process data sent by clients before that data
issentbacktootherclients.Extensionscanalsoprocessandcreatetheirownevents.Formany
Search WWH ::




Custom Search