Prev | Current Page 807 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Part II: Server Side, JavaScript, and Flash: Oh My!
436
SocketConnection
As already explained, a socket connection is a kind of communication that remains open between a client
and a server and that must be actively closed by one of the sides Table 15-7 . To create this kind of
connection, the haxe.remoting.SocketConnection class is used. Note that this class is used both at
the server side in a Neko application and at the client side, when the client is Flash or JavaScript.
JavaScript has no native implementation for socket communication. This limit can be overcome using a
tiny Flash movie as a bridge. The Flash movie can be built by just importing the SocketWrapper class
that adds the bridging features. JavaScript then uses the movie to communicate with the server.
The Flash movie can be compiled just with this single line:
import haxe.remoting.SocketWrapper;
A full and more advanced example of Socket connection is discussed later in this chapter in the
??? TicTacToe Game ??? section.
NekoSocketConnection
A haxe.


Pages:
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819