| Package | org.restfulx.controllers |
| Class | public class ServerPushController |
| Inheritance | ServerPushController flash.events.EventDispatcher |
First, install Juggernaut as described here: http://juggernaut.rubyforge.org/
Second, you need to set up ServerPushController
private var c:ServerPushController;
private function init():void {
Rx.enableLogging();
ApplicationController.initialize();
c = new ServerPushController("localhost", 5001);
c.addEventListener(ServerPushEvent.ID, onServerPush);
}
private function onServerPush(event:ServerPushEvent):void {
trace("message:" + event.message);
}
private function onServerPush(event:ServerPushEvent):void {
var unmarshalled:RxModel = Rx.serializers.xml.unmarshall(event.message)
as RxModel;
Rx.models.cache.create(unmarshalled);
}
juggernaut -c config/juggernaut.yml
Juggernaut.send_to_all("hello from the server")
| Property | Defined by | ||
|---|---|---|---|
| currentSignature : String current message signature
| ServerPushController | ||
| lastMessageId : String last message received from the server
| ServerPushController | ||
| opts : Object options for configuring ServerPushController such as channels
| ServerPushController | ||
| Method | Defined by | ||
|---|---|---|---|
|
ServerPushController(host:String, port:int, opts:Object = null)
Creates a new ServerPushController instance
| ServerPushController | ||
| currentSignature | property |
public var currentSignature:Stringcurrent message signature
| lastMessageId | property |
public var lastMessageId:Stringlast message received from the server
| opts | property |
public var opts:Objectoptions for configuring ServerPushController such as channels
| ServerPushController | () | constructor |
public function ServerPushController(host:String, port:int, opts:Object = null)Creates a new ServerPushController instance
Parametershost:String — the host to connect to (e.g. localhost)
|
|
port:int — the port to connec to (e.g. 5001)
|
|
opts:Object (default = null) — options to use during configuration/handshake, such as
channels to connect to
|