Package | org.idream.pomelo |
Class | public class Pomelo |
Inheritance | Pomelo ![]() |
Method | Defined By | ||
---|---|---|---|
Pomelo(useWeakReference:Boolean = true) | Pomelo | ||
beat():void
向服务器发送一次心跳事件
| Pomelo | ||
destroy():void
if you use new Pomelo(false)
(not using weak reference)
don't forget to call destroy()
| Pomelo | ||
disconnect():void
与服务器主动断开连接
| Pomelo | ||
[static] | Pomelo | ||
init(host:String, port:int, user:Object = null, callback:Function = null, timeout:int = 8000):void
初始化客户端,并尝试连接服务器
| Pomelo | ||
notify(route:String, msg:Object):void
向服务器发送数据
| Pomelo | ||
on(route:String, callback:Function):void
响应服务器的推送事件
| Pomelo | ||
request(route:String, msg:Object, callback:Function = null):void
向服务器请求数据
| Pomelo |
Event | Summary | Defined By | ||
---|---|---|---|---|
Pomelo | ||||
Pomelo | ||||
Pomelo | ||||
Pomelo | ||||
Pomelo |
Constant | Defined By | ||
---|---|---|---|
info : Object [static] | Pomelo | ||
requests : Dictionary [static] | Pomelo |
heartbeat | property |
public var heartbeat:int
message | property |
message:IMessage
public function get message():IMessage
public function set message(value:IMessage):void
Pomelo | () | Constructor |
public function Pomelo(useWeakReference:Boolean = true)
useWeakReference:Boolean (default = true )
|
beat | () | method |
public function beat():void
向服务器发送一次心跳事件
destroy | () | method |
public function destroy():void
if you use new Pomelo(false) (not using weak reference) don't forget to call destroy()
disconnect | () | method |
public function disconnect():void
与服务器主动断开连接
getIns | () | method |
init | () | method |
public function init(host:String, port:int, user:Object = null, callback:Function = null, timeout:int = 8000):void
初始化客户端,并尝试连接服务器
Parameters
host:String | |
port:int | |
user:Object (default = null ) — 客户端与服务器之间的自定义数据
| |
callback:Function (default = null ) — 当连接成功会调用此方法
| |
timeout:int (default = 8000 )
|
notify | () | method |
public function notify(route:String, msg:Object):void
向服务器发送数据
Parameters
route:String | |
msg:Object |
on | () | method |
public function on(route:String, callback:Function):void
响应服务器的推送事件
Parameters
route:String — 推送事件的名称
| |
callback:Function — 当服务器发生推送时会调用此函数
|
request | () | method |
public function request(route:String, msg:Object, callback:Function = null):void
向服务器请求数据
Parameters
route:String | |
msg:Object | |
callback:Function (default = null ) — 服务器返回数据时会回调
|
close | Event |
flash.events.Event
handshake | Event |
ioError | Event |
flash.events.IOErrorEvent
kicked | Event |
securityError | Event |
flash.events.SecurityErrorEvent
info | Constant |
public static const info:Object
requests | Constant |
public static const requests:Dictionary