How to send data between two devices running a PlayCanvas game?

Hi,
I would like two PlayCanvas games running on different devices send information (text strings) to each other. But I can not figure out how to do that.
Sending information directly to each other is not possible because of safety reasons.
So it has to be through some server I guess.
Setting up a server using node.js seems doable. But unfortunately my hosting provider does not support node.js. And I do not know if this is possible using PHP (I have zero experience with PHP).

Does anybody know if there are services available ment for this? Services where one could connect and communicate to others by using an unique ID for instance?

(P.S: WebRTC is a library to setup peer 2 peer connections. But to set up a peer 2 peer connection the two sides need to be able to send information to each other. So that is not solution. In fact, this is the reason I need this communication!).

Hi @simmania,

Have you checked the networking examples here? They showcase exactly that, how exchange data between playcanvas clients:
https://developer.playcanvas.com/en/tutorials/?tags=networking

Another alternative, if webrtc isn’t an option, is by using a serverless system like Firebase (search for it online).

The first two examples need nodejs on the server. Which my provider does not support. The third example uses Photon. It is ment for multiplayer games to synchronize stuff. Maybe I can use this to send my text data. I will investigate further. And I’m not sure what Firebase is all about. Seems overkill.

So I will study Photon a bit more. Thx

1 Like

An old school approach is to use polling, that means both clients write data to your server e.g. on a file using a Rest call (e.g. POST).

And they poll using a similar Rest call (GET) that file on a set interval (e.g. every 5 seconds), for any new data available.