All class peculiarities on the creation of a connection and their use will be discussed next.
The haXe Remoting is an open protocol and vendors are encouraged to develop alternative solutions.
At the server side, the only working solution right now is developed with Neko and part of the haXe
standard distribution but there are no reasons that impede to build alternatives in Java, PHP, or .Net.
Connection
A connection instance cannot be created using the class constructor but instead using one of the static
connect methods, as shown in the following example:
var cnx = haxe.remoting.Connection.jsConnect();
var r = cnx.mypackage.Calc.sum.call([5, 4]);
The cnx object simply calls the mypackage.Calc.sum() method on the other side of the connection and
returns the result.
To illustrate how it works, the haxe.remoting.Connection class implements Dynamic ; this
expedient is used by haXe to map a client invocation to a server method when the call() method is
used. haXe will try to locate the sum static method inside the Calc class in the mypackage package
contained in a compiled JavaScript script.
Pages:
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805