void Start() { //For WebGL games, use WebGLBroker.cs and javascript execution on the client to communicate with your game. pubnub = new Pubnub(PUBLISH_KEY, SUBSCRIBE_KEY); Subscribe(PUBSUB_CHANNEL); ConnectionStrategy.Ready(); }
void SendCommunicationActual(List <KeyValuePair <string, string> > parameters) { //Generally no need to communicate with a server if we are in the Editor. Else, just comment out. if (!Application.isEditor || AutomationMaster.ConfigReader.GetBool("SEND_COMMUNICATIONS_IN_EDITOR")) { StringBuilder json = new StringBuilder(); json.Append("["); //--Required Identifiers-- json.Append(string.Format("{{\"grid_identity\":\"{0}\"}},", GridIdentity)); json.Append(string.Format("{{\"grid_identity_buddy\":\"{0}\"}},", BuddyHandler.BuddyName)); json.Append("{{\"grid_source\":\"client\"}},"); json.Append(string.Format("{{\"test_run_id\":\"{0}\"}},", TestRunId)); json.Append(string.Format("{{\"device_udid\":\"{0}\"}},", DeviceUdid)); json.Append(string.Format("{{\"test_run_time\":\"{0}\"}},", AutomationMaster.Busy ? AutomationReport.TestSuiteRunTime.ToString() : "0 ")); json.Append(string.Format("{{\"game\":\"{0}\"}},", GameMaster.GAME_NAME)); //--End Required Params-- for (int x = 0; x < parameters.Count; x++) { json.Append(string.Format("{{\"{0}\":\"{1}\"}}", parameters[x].Key.ToLower(), parameters[x].Value.Replace("\"", "@APOS@").Replace("'", "@QUOT@"))); if (x + 1 < parameters.Count) { json.Append(","); } } json.Append("]"); ConnectionStrategy.SendCommunication(json.ToString()); AutoConsole.PostMessage(json.ToString(), ConsoleMessageType.Pubsub); } }
void Update() { if (!CheckedIn && SubscriptionsComplete) { ConnectionStrategy.Ready(); CheckedIn = true; } }
private void ReceiveCallback(IAsyncResult ar) { StateObject state = (StateObject)ar.AsyncState; Socket client = state.workSocket; int bytesRead = client.EndReceive(ar); if (bytesRead > 0) { state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead)); client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReceiveCallback), state); } if (!string.IsNullOrEmpty(state.sb.ToString())) { ConnectionStrategy.ReceiveMessage(state.sb.ToString()); } }
public void ReceiveMessagePubsub(string result) { Arbiter.LocalRunLaunch = false; ConnectionStrategy.ReceiveMessage(result); }
//Incoming call from browser (Sent by "SendMessage()" Unity javascript method that points to this class and method). public void LaunchTest(string test) { ConnectionStrategy.ReceiveMessage(string.Format("{{ \"automation_command\": \"rt *{0}\" }}", test)); }
static string RunTests(List <string> args) { Arbiter.LocalRunLaunch = true; ConnectionStrategy.ReceiveMessage(string.Format("{{ \"automation_command\": \"rt {0}\" }}", string.Join(string.Empty, args.ToArray()))); return("Test run command received. Please view the Nexus AutoConsole for further logging updates."); }
static string LaunchTrilleonFrameworkValidation(List <string> args) { Arbiter.LocalRunLaunch = true; ConnectionStrategy.ReceiveMessage("[{\"automation_command\": \"rt Trilleon/Validation\"}]"); return("Validation Started; Request logs to view ongoing results."); }