question

anhtuancmu avatar image
anhtuancmu asked

Photon Webhooks not triggered in OnEventCall()

Hi, when i call

PhotonNetwork.RaiseEvent(20, eventContent: newHashtable() { { "code", 20 }, { "opponentId", "93C23F59F95DB67E" } }, sendReliable: true, options: new RaiseEventOptions() { ForwardToWebhook = true })

outside OnEventCall() it working fine but when i call it inside the webhooks is not being called. Anyone have faced this problem?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hamza Lazaar avatar image
Hamza Lazaar answered

Hi @anhtuancmu,

Thank you for choosing Photon!

PUN does not implement WebFlags and other features related to webhooks as we usually recommend the Unity SDK for this.

For the time being, if you just want to forward RaiseEvent webhooks (same thing/fix applies for SetProperties), please try the following:

replace line 706 in LoadBalancingPeer.cs:

old:

opParameters[(byte) ParameterCode.EventForward] = true; //TURNBASED

new:

opParameters[(byte) ParameterCode.EventForward] = (byte)1; //TURNBASED
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

anhtuancmu avatar image anhtuancmu commented ·

Hi,

I tried, same result, it didn't triggered t

0 Likes 0 ·
brendan avatar image
brendan answered

What is the Title ID in question, and what Photon App ID are you using?

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

anhtuancmu avatar image anhtuancmu commented ·

My title 64F6

My photon id

8ea08d48-8f47-4550-a829-bbbe7f540c3b

0 Likes 0 ·
brendan avatar image brendan anhtuancmu commented ·

Everything appears to be configured correctly. Could you try putting something in the default case of your switch statement which either generates an event or sets a value in the user data, to indicate that it took that code path, so that we can make sure that's not what's happening?

0 Likes 0 ·
anhtuancmu avatar image anhtuancmu brendan commented ·

As I mentioned above, when I raise event out side the OnEventCall() the webhooks is triggered and working properly, but not when I raise event inside. So I don't the problems is in my script.

public class Controller : MonoBehaviour
{
	...
	void Start()
	{
		//This One Working Properly
		PhotonNetwork.RaiseEvent(20, eventContent: newHashtable() { { "code", code }, { "data", "data" } }, sendReliable: true, options: new RaiseEventOptions() { ForwardToWebhook = true })
		Debug.Log("Event Raised");
	}


	void Awake()
    {
       
        PhotonNetwork.OnEventCall += this.OnEvent;


    }
	
	private void OnEvent(byte eventcode, object content, int senderid)
    {
		//This One Not Triggered The WebHooks
		PhotonNetwork.RaiseEvent(20, eventContent: newHashtable() { { "code", code }, { "data", "data" } }, sendReliable: true, options: new RaiseEventOptions() { ForwardToWebhook = true })
		Debug.Log("Event Raised");


	}
	...


}

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.