Connecting to Photon Server with PHP through Linux C++ SDK?

Hi,

Just want to check my hypothesis...

We will have a running photon server. And have Unity Clients.
This will create rooms with many-to-many video-chats (with StreamSDK).
We will create a Plugin which will save all the streams to disk.
So far so good...

Now we want to have our php backend to communicate to all connected users, or to a specific user (with a userID).
So we want to have a php client to connect to the photon server.
And since php can wrap c++ code, we want to use the Linux c++ SDK to do this.

What are your thoughts about this approach?
1) is it possible for a client to communicate to all users, or specific users? Or do I need two different photon server instances? (one for videochat rooms and one big room for other global events to (all/specific) users)
2) is this the way to go to implement a php client to communicate to photon server?

Thanks in advance!

Comments

  • KaiserludiKaiserludi admin
    edited November 29
    Hi @sentoplene.

    1.
    With the standard LoadBalancing application Clients can only communicate with other clients that are inside the same room. Cross-room communication is not supported. Putting all users of your app into one big room will cause scaling problems.
    By far the simplest way would be to use Photon Chat and to let all clients have a Photon Chat connection additionally to their Photon server connection. They would then all subscribe to the same Chat channel through which your special Linux client could communicate with the Unity clients (note: Photon Chat is not restricted to text messages. You can send all kinds of data with it that are supported by Photons serialization protocol).
    However Photon Chat is only available as a Photon Cloud service. If that is no option for you and you need to stick with Photon server, then you would need to write your own server side Photon application either from scratch or based on the LoadBalancing application, and add functionality for cross-room communication yourself (this will be a lot of complex work involving scaling across multiple servers, server2server communication, etc. and I would not recommend this approach).

    2.
    Setting up your PHP server as an external webservice and letting your Untiy clients connect to it through Photon WebRPCs (see https://doc.photonengine.com/en-us/server/v4/reference/webrpc) may be what makes the most sense for your scenario.
    @JohnTube, what do you think?
  • JohnTubeJohnTube mod
    edited November 30
    Hi @sentoplene,

    Thank you for choosing Photon!

    My colleague @Kaiserludi already answered the first part but I think there is a misunderstanding about the second part.

    Now we want to have our php backend to communicate to all connected users, or to a specific user (with a userID).
    So we want to have a php client to connect to the photon server.
    And since php can wrap c++ code, we want to use the Linux c++ SDK to do this.
    So you want to have a "special" Photon client from your backend to connect to the Photon Server to communicate with other "normal/regular" clients through it. I think you are overcomplicating things especially with the PHP wrapper around the C++ part. First could you tell us why this client needs to communicate with others? maybe just my colleague @Kaiserludi mentioned, other clients need to communicate to your backend only and no the other way around and you can do this using HTTP only. You could do polling or you can explore other server-to-client messaging systems like push notifications etc.
Sign In or Register to comment.