Quantcast
Channel: JavaScript and TypeScript — Photon Engine
Viewing all articles
Browse latest Browse all 162

JS realtime communication with PUN

$
0
0
Hi, I'm building a cross platform app with PUN for Unity and the Javascript Realtime SDK for HTML5. I have successfully gotten the clients to see each other, create rooms, join sessions, etc. I have been unable to get my messaging to work in both directions. On the original PUN version, I used RPC calls to send Game Events. I was able to receive these via HandleEvent in Javascript. When attempting to reply from javascript, the only reference I could find in the SDK is for raiseEvent. I was also able to determine that 200 is the event code for RPC calls. Here is where I start to run into trouble... When the RPC is received, it fails the following NetworkingPeer.cs check: if (rpcData == null || !rpcData.ContainsKey((byte)0)) { Debug.LogError("Malformed RPC; this should never occur. Content: " + SupportClassPun.DictionaryToString(rpcData)); return; } The problem is that even when I send something as simple as: var data = {}; data[0] = 1; photonClient.raiseEventAll(200, data); //200 == RPC the 0 arrives as "0" and is != (byte)0 How am I supposed to send Events/RPCs to PUN from the Javascript Realtime SDK? Thanks! Rob

Viewing all articles
Browse latest Browse all 162

Trending Articles