Hydrogen Framework  1.3.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Hydrogen.Core.WebPoolWorker Class Reference

An internal web call used within the Hydrogen Framework. More...

+ Inheritance diagram for Hydrogen.Core.WebPoolWorker:

Public Member Functions

override void DespawnSafely ()
 Fallback Despawn Function More...
 
int Form (string URI, Dictionary< string, string > formStringData, WebPool.FormBinaryData[] formBinaryData, string cookie, System.Action< int, Hashtable, string > callback)
 Form the specified URI, formStringData, formBinaryData, cookie and callback. More...
 
int GET (string URI, string cookie, System.Action< int, Hashtable, string > callback)
 GE the specified URI, cookie and callback. More...
 
override bool IsInactive ()
 Is the GameObject idle, and therefore can be despawned organically? More...
 
override void OnDespawned ()
 Raised when the GameObject is despawned back into it's Web Pool. More...
 
override void OnSpawned ()
 Raised when the GameObject is spawned from it's Web Pool. More...
 
int POST (string URI, string contentType, string payload, string cookie, System.Action< int, Hashtable, string > callback)
 HTTP POST Form to URI. More...
 

Detailed Description

An internal web call used within the Hydrogen Framework.

Currently this is broken for servers that alter their status codes based on their operation.

A bug has been filed with Unity demonstrating this: http://fogbugz.unity3d.com/default.asp?577333_a0l3gs97bj9ubdis

Definition at line 45 of file WebPoolWorker.cs.

Member Function Documentation

override void Hydrogen.Core.WebPoolWorker.DespawnSafely ( )
virtual

Fallback Despawn Function

Implements Hydrogen.Core.ObjectPoolItemBase.

Definition at line 59 of file WebPoolWorker.cs.

60  {
61  OnDespawned ();
62  }
override void OnDespawned()
Raised when the GameObject is despawned back into it&#39;s Web Pool.
int Hydrogen.Core.WebPoolWorker.Form ( string  URI,
Dictionary< string, string >  formStringData,
WebPool.FormBinaryData[]  formBinaryData,
string  cookie,
System.Action< int, Hashtable, string >  callback 
)

Form the specified URI, formStringData, formBinaryData, cookie and callback.

Returns
The Call Hash
Parameters
URIThe Target URI
formStringDataA Dictionary<string,string> of Form Data
formBinaryDataA custom binary dataset. Useful for uploading pictures.
cookieAny previous cookie data to be used for authentication.
callbackA callback function (int hash, Hashtable headers, string payload).

Definition at line 73 of file WebPoolWorker.cs.

74  {
75  _hash = (Time.time + URI + formStringData.GetHashCode () + Random.Range (0, 100)).GetHashCode ();
76 
77  StartCoroutine (FormReturnedText (URI, formStringData, formBinaryData, cookie, callback));
78 
79  return _hash;
80  }
int Hydrogen.Core.WebPoolWorker.GET ( string  URI,
string  cookie,
System.Action< int, Hashtable, string >  callback 
)

GE the specified URI, cookie and callback.

Returns
The Call Hash
Parameters
URIThe Target URI
cookieAny previous cookie data to be used for authentication.
callbackA callback function (int hash, Hashtable headers, string payload).

Definition at line 89 of file WebPoolWorker.cs.

90  {
91  _hash = (Time.time + URI + Random.Range (0, 100)).GetHashCode ();
92 
93  StartCoroutine (GetReturnedText (URI, cookie, callback));
94 
95  return _hash;
96  }
override bool Hydrogen.Core.WebPoolWorker.IsInactive ( )
virtual

Is the GameObject idle, and therefore can be despawned organically?

Implements Hydrogen.Core.ObjectPoolItemBase.

Definition at line 101 of file WebPoolWorker.cs.

102  {
103  return !_busy;
104  }
override void Hydrogen.Core.WebPoolWorker.OnDespawned ( )
virtual

Raised when the GameObject is despawned back into it's Web Pool.

Implements Hydrogen.Core.ObjectPoolItemBase.

Definition at line 109 of file WebPoolWorker.cs.

110  {
111  StopAllCoroutines ();
112  _hash = 0;
113  gameObject.SetActive (false);
114  }
override void Hydrogen.Core.WebPoolWorker.OnSpawned ( )
virtual

Raised when the GameObject is spawned from it's Web Pool.

Implements Hydrogen.Core.ObjectPoolItemBase.

Definition at line 119 of file WebPoolWorker.cs.

120  {
121  gameObject.SetActive (true);
122  _hash = 0;
123  }
int Hydrogen.Core.WebPoolWorker.POST ( string  URI,
string  contentType,
string  payload,
string  cookie,
System.Action< int, Hashtable, string >  callback 
)

HTTP POST Form to URI.

Returns
The Call Hash
Parameters
URIThe Target URI.
formStringDataA Dictionary<string,string> of Form Data
formBinaryDataA custom binary dataset. Useful for uploading pictures.
cookieAny previous cookie data to be used for authentication.
callbackA callback function (int hash, Hashtable headers, string payload).

Definition at line 134 of file WebPoolWorker.cs.

135  {
136  _hash = (Time.time + URI + payload + Random.Range (0, 100)).GetHashCode ();
137 
138  StartCoroutine (PostReturnedText (URI, contentType, payload, cookie, callback));
139 
140  return _hash;
141  }