/// <summary> /// Method to act upon and process a received message of type WebSocketServerConnector.MessageJSONAPI.DefaultMessage, allowing for any desired (and Unity GameObject-related) action in the application. /// </summary> private void performNextDefaultMessage() { // retrieve first message in the list WebSocketServerConnector.MessageJSONAPI.DefaultMessage message = receivedDefaultMessages[0]; // delete retrieved (first) message from the list (= queue) receivedDefaultMessages.RemoveAt(0); // LOGIC IMPLEMENTATION AND FURTHER PROCESSING BASED ON THE MESSAGE /* * // access properties of WebSocketServerConnector.MessageJSONAPI.DefaultMessage * Debug.Log(message); * Debug.Log(message.sender); * Debug.Log(message.receiver); * Debug.Log(message.api); * Debug.Log(message.valueString); * Debug.Log(message.valueInt); * Debug.Log(message.valueFloat); * Debug.Log(message.valueBool); */ // do something }
/// <summary> /// Method to add a new message to the message collection list (functioning conceptually as a queue). /// </summary> /// <param name="receivedMessage">Instance of type WebSocketServerConnector.MessageJSONAPI.DefaultMessage, representing a received message that needs to be further processed within this class.</param> public void queueDefaultMessage(WebSocketServerConnector.MessageJSONAPI.DefaultMessage receivedMessage) { receivedDefaultMessages.Add(receivedMessage); }