| Package | net.flashmog |
| Class | public class RPCSocket |
| Inheritance | RPCSocket flash.net.Socket |
| Property | Defined by | ||
|---|---|---|---|
| host : String [read-only]
property accessor func which returns this RPCSocket's host value
| RPCSocket | ||
| onConnect : Function [write-only]
Set function for the onConnect event handler of this Class
| RPCSocket | ||
| port : int [read-only]
property accessor func which returns this RPCSocket's port value
| RPCSocket | ||
| serializeMethod : String
A string specifying the serialization technique of this RPCSocket
My intent with this variable was to allow a user to specify which serialization technique
should be used for a given socket.
| RPCSocket | ||
| version : String = "0.3.1"
Just specifies a version
| RPCSocket | ||
| Method | Defined by | ||
|---|---|---|---|
|
constructor function
NOTE: unlike the base XMLSocket class, I REQUIRE the host and port arguments for this
constructor.
| RPCSocket | ||
|
close():void
Closes the underlying XMLSocket
| RPCSocket | ||
|
connect(host:String, port:int):void
Connects the underlying XMLSocket
This method validates both the host and port params previously supplied to
the constructor, sets the boolWaitingForConnect
boolean to true and then calls the connect method of the XMLSocket,
returning whatever that returns.
| RPCSocket | ||
|
executeRPC(serviceName:String, methodName:String, methodParams:Array):void
Sends a request for the server to execute an RPC
This method takes the given parameters and from them generates a well-formed
RPC request according to the FlashMOG protocol.
| RPCSocket | ||
|
registerService(svc:FlashMOGService):Boolean
Registers a Service object with this RPCSocket
When a Service object attempts to connect to a particular
host and port, it is referred to an existing socket connection via
the static methods of the ConnectionPool Class.
| RPCSocket | ||
|
unRegisterService(serviceNameArg:String):void
UnRegisters a service from the current RPCsocket
This method works by making a copy of services without including the Service
with a name matching serviceNameArg.
| RPCSocket | ||
| Constant | Defined by | ||
|---|---|---|---|
| BUFFER_STATE_READING : * = 1 [static]
| RPCSocket | ||
| BUFFER_STATE_READY : * = 0 [static]
| RPCSocket | ||
| MAX_BUFFER_LENGTH : * = 10000000 [static]
| RPCSocket | ||
| MESSAGE_LENGTH_INDICATOR_BYTES : * = 4 [static]
| RPCSocket | ||
| SERIALIZE_METHOD_AMF3 : String = "AMF3" [static]
| RPCSocket | ||
| SERIALIZE_METHOD_JSON : String = "JSON" [static]
| RPCSocket | ||
| SERIALIZE_METHOD_PHP : String = "PHP" [static]
class constants
| RPCSocket | ||
| SERIALIZE_METHOD_XML : String = "XML" [static]
| RPCSocket | ||
| host | property |
host:String [read-only]property accessor func which returns this RPCSocket's host value
Implementation public function get host():String
| onConnect | property |
onConnect:Function [write-only]Set function for the onConnect event handler of this Class
Implementation public function set onConnect(value:Function):void
| port | property |
port:int [read-only]property accessor func which returns this RPCSocket's port value
Implementation public function get port():int
| serializeMethod | property |
public var serializeMethod:StringA string specifying the serialization technique of this RPCSocket My intent with this variable was to allow a user to specify which serialization technique should be used for a given socket. As of this writing, I have not yet figured out how to expose this property to Services because two distinct Services could in theory try to specify different serialization techniques but share a single RPCSocket. What to do?
| version | property |
public var version:String = "0.3.1"Just specifies a version
| RPCSocket | () | constructor |
public function RPCSocket(hostArg:String, portArg:int, serializeMethodArg:String, logger:Log = null)constructor function NOTE: unlike the base XMLSocket class, I REQUIRE the host and port arguments for this constructor. I do this to avoid potential consistency problems should one service construct and connect an RPCSocket with one host/port combination and then a subsequent try to connect using another while we are still waiting for the first connection. This might be a big inconvenient as we must create a new XMLSocket to connect to a different host/port but that is how the classes work that use this class so it should not be a problem. The advantage we gain by requiring host & port here is that we no longer need these values for the connect() method.
ParametershostArg:String — hostArg the IP or host name of the socket server
|
|
portArg:int — portArg the port integer where the server is listening for sockets connex
|
|
serializeMethodArg:String — serializeMethodArg string ID to specify what serialization technique is
to be used for transmission of RPC requests across the socket. Should match one of the
SERIALIZE_METHOD_class constants
|
|
logger:Log (default = null) — logger the object to handle log.write commands
|
| close | () | method |
public override function close():voidCloses the underlying XMLSocket
| connect | () | method |
public override function connect(host:String, port:int):voidConnects the underlying XMLSocket This method validates both the host and port params previously supplied to the constructor, sets the boolWaitingForConnect boolean to true and then calls the connect method of the XMLSocket, returning whatever that returns.
Parametershost:String — hostArg - a host argument which is ignored in favor of the value supplied in the constructor
|
|
port:int — portArg - a host argument which is ignored in favor of the value supplied in the constructor
|
| executeRPC | () | method |
public function executeRPC(serviceName:String, methodName:String, methodParams:Array):voidSends a request for the server to execute an RPC This method takes the given parameters and from them generates a well-formed RPC request according to the FlashMOG protocol. A well-formed RPC request is a serialized array with 3 elements: - 0 a service name - 1 a method name - 2 the parameters to apply the method to Serialization techniques may eventually vary but as of this writing they are limited to PHP Serialization. Sephiroth's AS3 serializer class is used to implement the serialization client-side
ParametersserviceName:String — serviceName the name of the target service class on the server
|
|
methodName:String — methodName the name of the target method of the server-side service
|
|
methodParams:Array — methodParams an array containing parameters to be processed by the method
|
| registerService | () | method |
public function registerService(svc:FlashMOGService):BooleanRegisters a Service object with this RPCSocket When a Service object attempts to connect to a particular host and port, it is referred to an existing socket connection via the static methods of the ConnectionPool Class. If one exists and it is 'registered' to that socket via this function the net effect is that a reference to the Service is stored in this RPCSocket's services array. If none exists, a new one is created and the Service is then registered that new RPCSocket
Parameterssvc:FlashMOGService — svc the Service object being registered
|
Boolean |
| unRegisterService | () | method |
public function unRegisterService(serviceNameArg:String):voidUnRegisters a service from the current RPCsocket This method works by making a copy of services without including the Service with a name matching serviceNameArg. If no services are left or the remaining ones are not using the socket, the socket closes itself
ParametersserviceNameArg:String — serviceNameArg the name of the Service object being UnRegistered
|
| BUFFER_STATE_READING | constant |
public static const BUFFER_STATE_READING:* = 1
| BUFFER_STATE_READY | constant |
public static const BUFFER_STATE_READY:* = 0
| MAX_BUFFER_LENGTH | constant |
public static const MAX_BUFFER_LENGTH:* = 10000000
| MESSAGE_LENGTH_INDICATOR_BYTES | constant |
public static const MESSAGE_LENGTH_INDICATOR_BYTES:* = 4
| SERIALIZE_METHOD_AMF3 | constant |
public static const SERIALIZE_METHOD_AMF3:String = "AMF3"
| SERIALIZE_METHOD_JSON | constant |
public static const SERIALIZE_METHOD_JSON:String = "JSON"
| SERIALIZE_METHOD_PHP | constant |
public static const SERIALIZE_METHOD_PHP:String = "PHP"class constants
| SERIALIZE_METHOD_XML | constant |
public static const SERIALIZE_METHOD_XML:String = "XML"