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, ElectroServer has some specific features that we should discuss. Some of
these exist on other socket-server platforms, while some don't. However, much of this
discussion will still be applicable to other socket servers once they make JavaScript APIs
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 send messages through the API to ElectroServer. This is
usually a game, a chat room, a virtual 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
When a user first connects to ElectroServer, she needs to join or create a zone , which
is simply 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.
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
Extensions are server-side code modules that can process data sent by clients before
that data is sent back to other clients. Extensions can also process and create their own
events. For many games, the extension contains much of the game logic, relying on the
clients for displaying and gathering user input.
Search WWH ::

Custom Search