Packagenet.flashmog
Classpublic class FlashMOGService
InheritanceFlashMOGService Inheritance flash.events.EventDispatcher



Public Properties
 PropertyDefined by
  client : Object
A convenient object to hold client-side methods defined by the developer When an incoming RPC is received by an RPC socket, it will contain an eventName parameter.
FlashMOGService
  connected : Boolean
[read-only] get method for the property connected
FlashMOGService
  log : Log
An object to receive log messages, must implement 'write' method which accepts two params: the message and its priority
FlashMOGService
  name : String
[read-only] Read only accessor for this Service's name Returns the the name of the service which both specifies the class to be instantiated Server-side to handle requests from this service and also uniquely identifies this service object as the client-side handler for incoming rpc requests on this RPCSocket
FlashMOGService
  server : FlashMOGServerProxy
This is a Proxy object to route requests from the client for server-side methods to the RPCSocket This object is necessary because it would be inconvenient and redundant if we were forced to define or declare all server-side methods in the client too.
FlashMOGService
  socket : RPCSocket
[read-only] Read only accessor for the underlying RPCSocket object
FlashMOGService
  version : String = "0.3.1"
Just specifies a version
FlashMOGService
  waitingForSocketConnect : Boolean
[read-only] get method for the property boolWaitingForSocketConnect
FlashMOGService
Public Methods
 MethodDefined by
  
FlashMOGService(hostArg:String, portArg:int, serviceNameArg:String, serializeMethodArg:String = null, logArg:Log = null)
Constructor for this class When instantiating this class, the host and port must be passed.
FlashMOGService
  
close():void
closes this service This method 'closes' this service which will disable it from handling any more incoming or outgoing RPC calls.
FlashMOGService
  
connect():void
Tries to connect via socket to the server This func will attempt to have its RPCsocket connect to the server.
FlashMOGService
Property detail
clientproperty
public var client:Object

A convenient object to hold client-side methods defined by the developer When an incoming RPC is received by an RPC socket, it will contain an eventName parameter. If any member function of this client object matches that eventName, then it will be invoked with any arguments extracted from the incoming event. A developer may define these client-side methods on this object like so: myService.client.myMethod = function(args) { trace('here is myMethod! See it run run run!); }

connectedproperty 
connected:Boolean  [read-only]

get method for the property connected

Implementation
    public function get connected():Boolean
logproperty 
public var log:Log

An object to receive log messages, must implement 'write' method which accepts two params: the message and its priority

nameproperty 
name:String  [read-only]

Read only accessor for this Service's name Returns the the name of the service which both specifies the class to be instantiated Server-side to handle requests from this service and also uniquely identifies this service object as the client-side handler for incoming rpc requests on this RPCSocket

Implementation
    public function get name():String
serverproperty 
public var server:FlashMOGServerProxy

This is a Proxy object to route requests from the client for server-side methods to the RPCSocket This object is necessary because it would be inconvenient and redundant if we were forced to define or declare all server-side methods in the client too. In order to handle a server request, this object needs access to quite a few members of this Service (e.g, boolConnected, the serializer object, etc.) We therefore pass a reference to THIS in this Service object's constructor below

socketproperty 
socket:RPCSocket  [read-only]

Read only accessor for the underlying RPCSocket object

Implementation
    public function get socket():RPCSocket
versionproperty 
public var version:String = "0.3.1"

Just specifies a version

waitingForSocketConnectproperty 
waitingForSocketConnect:Boolean  [read-only]

get method for the property boolWaitingForSocketConnect

Implementation
    public function get waitingForSocketConnect():Boolean
Constructor detail
FlashMOGService()constructor
public function FlashMOGService(hostArg:String, portArg:int, serviceNameArg:String, serializeMethodArg:String = null, logArg:Log = null)

Constructor for this class When instantiating this class, the host and port must be passed. An attempt will be made to locate an existing RPCsocket via the ConnectionPool class. If an RPCSocket for the current host/port already exists, the existing connection will be used. If not, a new one will be created. In either case, this Service will be registered as a user of that RPCSocket object.

Parameters
hostArg:String — serviceName specifies which class we instantiate on the server in order to handle requests from this service. It also uniquely identifies this Service object as the destination for incoming calls intended for this service. MUST BE UNIQUE for a given RPCSocket.
 
portArg:int — hostArg String containing the host where the socket server daemon is running
 
serviceNameArg:String — portArg Integer specifying which port the socket daemon is listening to
 
serializeMethodArg:String (default = null) — serviceNameArg This param both uniquely names this service here on the client and also specifies what class is to be instantiated server-side to handle RPC requests
 
logArg:Log (default = null) — serializeMethod a string id specifying what serialization method is used to package up RPC requests for transmission across the socket
Method detail
close()method
public function close():void

closes this service This method 'closes' this service which will disable it from handling any more incoming or outgoing RPC calls. More specifically, it 'unregisters' itself with the RPCSocket which forces the RPCsocket to check if any other services are still using the RPCSocket. If not, the RPCSocket closes itself. It also removes any event listeners in this class that listen to the socket

connect()method 
public function connect():void

Tries to connect via socket to the server This func will attempt to have its RPCsocket connect to the server. If the socket is already connected (perhaps serving some other Service) then the connect event of this Service will be dispatched immediately. If not, this Service will be marked as boolWaitingForSocketConnect while waiting for the RPCsocket to connect