Class Index | File Index

Classes


Namespace R.util.SocketUtil

A static class to create sockets for two-way network communication. This uses socket.IO as the socket provider to abstract the many different transport mechanisms. It is recommended that you see the example Node.JS server provided with The Render Engine to get an understanding of creating your own server.
Defined in: socket.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
Socket acknowledges message received and handled type
 
Socket connected message type
 
Socket disconnected message type
 
Server broadcast message type
Method Summary
Method Attributes Method Name and Description
 
createSocket(connectionURL, port, secure)
Create a socket for network communication.
Namespace Detail
R.util.SocketUtil
Field Detail
MSG_ACK
Socket acknowledges message received and handled type

MSG_CONNECT
Socket connected message type

MSG_DISCONNECT
Socket disconnected message type

MSG_SERVER
Server broadcast message type
Method Detail
{R.Socket} createSocket(connectionURL, port, secure)
Create a socket for network communication. A socket is a self contained object which has methods for sending messages of various types. When you are finished with the socket, call its done() method to disconnect from the server and return the socket to the pool.

As soon as you've created the socket, you can start sending messages. Messages will be queued until the socket is connected. A method called listener() can be attached to the socket so that messages arriving back from the socket can be handled.

   var socket = R.util.SocketUtil.createSocket('my.url.com/server/io.js');
   socket.listener = function(type, message) {
      if (type == R.util.SocketUtil.MSG_CONNECT) {
         alert("connected!");
      }
   };
   socket.connect();
For information about using a socket, see R.Socket
Parameters:
connectionURL
{String} The URL to connect to
port Optional
{Number} The port to connect to (default: 8090)
secure Optional
{Boolean} true to use a secure connection (default: false)
Returns:
{R.Socket} A socket object

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:21 GMT-0400 (EDT)