32
static var sockets = Reflect.empty();
36
var rcnx : haxe.remoting.Connection;
37
var cnx : haxe.remoting.Connection;
32
var cnx : haxe.remoting.ExternalConnection;
39
34
public function new( flashObject : String ) {
41
rcnx = haxe.remoting.Connection.flashConnect(flashObject).haxe.remoting.SocketWrapper;
42
rcnx.create.call([id]);
43
this.cnx = rcnx.sockets.__resolve(Std.string(id));
44
Reflect.setField(sockets,id,this);
47
public function destroy() {
48
rcnx.destroy.call([id]);
49
Reflect.deleteField(sockets,id);
35
var ctx = new haxe.remoting.Context();
36
var cnx = haxe.remoting.ExternalConnection.flashConnect("SocketWrapper",flashObject,ctx);
37
var sockId = cnx.api.create.call([flashObject]);
39
ctx.addObject("api",this,false);
40
this.cnx = haxe.remoting.ExternalConnection.flashConnect(sockId,flashObject,ctx);
52
43
public function connect( host : String, port : Int ) {
53
cnx.connect.call([host,port]);
44
cnx.sock.connect.call([host,port]);
56
47
public function send( data : String ) {
57
cnx.send.call([data]);
48
cnx.sock.send.call([data]);
60
51
public function close() {
64
public function onData( data : String ) {
67
public function onClose() {
70
public function onConnect( b : Bool ) {
52
cnx.sock.close.call([]);
53
cnx.api.destroy.call([]);
57
public dynamic function onData( data : String ) {
60
public dynamic function onClose() {
63
public dynamic function onConnect( b : Bool ) {