/// <summary> /// Make a JMessage from namepaths data /// </summary> /// <param name="namepaths"></param> /// <param name="values"></param> public NPMessage(NPMessageType type, NPMessageNamepathData[] data, string message = null) { if (data == null) { data = new NPMessageNamepathData[0]; } m_NamePaths = data; Text = message; MessageType = type; }
/// <summary> /// Sends a message and waits for response if needed. /// </summary> /// <param name="msg">The message to send</param> /// <param name="requireResponse">If true a response will be required from the other party. Synchronius action.</param> /// <param name="toWebsocket">If null then broadcase (as a server, this would mean sending to all clients)</param> /// <returns>The response if required, otherwise null.</returns> public NPMessage Send(NPMessageType type, string msg, NPMessageNamepathData data, bool requireResponse = false, string toWebsocket = null) { return(Send(type, msg, data == null ? null : new NPMessageNamepathData[1] { data }, requireResponse, toWebsocket)); }