/// <summary> /// Example of sending to a custom message to the server. /// /// Server could be replaced by known peer Id etc. /// </summary> /// <param name="intent">Choice of delivery intent ie Reliable, Fast etc. </param> /// <param name="payload">Custom payload to send with message</param> public void SendMessage(int opcode, DeliveryIntent intent, string payload) { UnityEngine.Debug.Log("SendMessage"); Client.SendMessage(Client.NewMessage(opcode) .WithDeliveryIntent(intent) .WithTargetPlayer(Constants.PLAYER_ID_SERVER) .WithPayload(StringToBytes(payload))); }
public void SendMessage(bool fast, int opCode, String str, int target) { RTMessage msg = realtimeClient.NewMessage(opCode); DeliveryIntent intent = fast ? DeliveryIntent.Fast : DeliveryIntent.Reliable; Byte[] payload = StringToBytes(str); realtimeClient.SendMessage(msg.WithDeliveryIntent(intent).WithPayload(payload).WithTargetPlayer(target)); }