Which server is better choice for multiplayer in PlayCanvas

Yeah I’ve had this problem in my last project, I think it’s to do with the new SDK. Go ahead and delete your old app.js script, and then create a brand new blank script called ‘app.js’. Inside this, erase all old content and paste the contents of app.js from the starter kit. No need to fork it, just copy paste the contents of the script from that project.

Another error happen :joy: Is that happen to you too?

error3
Thanks for your quick reply.

Hey @Elliot,

No I haven’t seen that issue before :thinking:. Can you post your console output? And if possible, could you please share a public project link?

Sure @DevilZ This is my link to editor
https://playcanvas.com/project/801852/overview/photon-testing

I’ve put in the app.js script I use for my projects and it seems to work fine now. https://playcanvas.com/editor/scene/1170822

1 Like

WOW…The app.js that your give me look a bit different from the githuh but that reason why it working. Thankssss.

Sorry for one last question :disappointed_relieved: When I hit play it give me the error Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS. after I fill the appid. Is that normal or abnormal behavior?

And I notice my demoloadbalancing.js unable to parse as well.

Really sorry keep disturbing you :disappointed_relieved: :disappointed_relieved: Hope you don’t mind it.

Have you created a manager.js as is done in the starter kit?

I’ve never had to parse that, that doesn’t need to be added to any entity.

Ya , I already create manager.js as well and attached it to an empty entity.

Hmm, that is odd, I’ll definitely have a look when I’m back at my PC, but it didn’t happen to me when I ran the project last night. Can you post console output?

Here you go.

I also feel frustrated when doing this.

Hi @Elliot,
Can you please take a look at this project? I think it may help you…

Unfortunately, i did not get time to continue experiments… :roll_eyes:

1 Like

Thanksss, I didn’t noticed this thread before. I try out this method but unfortunately same error come out after I launch WebSocket connection may not be initiated from a page loaded over HTTPS. which also happen to you as well. I suspected something go wrong with Photon_JavaScript_SDK.js but I unable to fix it. Sad man :disappointed_relieved: :disappointed_relieved:

Hey @Elliot, I’m sorry for the late reply, but had a very busy day despite it being a weekend. I’ve fixed the issues your project has, and Photon is working perfectly now. https://playcanvas.com/editor/scene/1170822.

1 Like

Omg, that amazing. Really…I try to fix the script again and again but still can’t fix that problem.

Thanks @DevilZ for help me to fix the issues and I bother you again and again. :sweat: :sweat: :sweat: Anyway thanks for you kindness and dedicated your precious time to help fix this stupid issue. You so nice man.

At the end it more like a how to use photon engine sdk more than compare which server is better.

1 Like

Hey folks, great to see such good insights here!

@yaustar @DevilZ I was wondering if you had any recommendations for where to host PlayCanvas apps using Photon servers?

I’m working on a project and would like to know if I could go for something like a Github Pages/Netlify frontend, and host the servers through Photon?

I haven’t seen much info around and would love to know more experienced reckons here.

Are you using Photon cloud or Photon dedicated server? The former will not be affected by where you host, only by the subscription plan you choose. The latter would also not be dependent on your frontend, but performance would vary based on your server configuration.

2 Likes

Great observation @DevilZ - I wasn’t aware of this, but from reading the spec, we’ll be going with Photon Cloud as there’s not much development time available to set up a dedicated server.

1 Like

Sounds good! Photon Cloud will be unaffected by your frontend, performance will only depend on the pricing plan you use. Good luck with your project!

1 Like

Thanks, @DevilZ.

Out of curiosity, upon reading the self-hosting documentation for PlayCanvas, they mention of having to run the app from a server like nginx or even a Python server. What have you used in the past, and has proven easiest to deal with?

We thought we could just host the frontend, but now we’re thinking we’ll just have to host an Ubuntu server through AWS/Azure/GCP. But because we don’t have much time to spike this, I’d love to hear your thoughts here.

Thanks a bunch in advance!

I’ve tried using Firebase hosting as well as GH pages. Haven’t tried Netlify. My clients have successfully used AWS to host some apps that I have built for them as well. It all depends on how intensive the app(not including the multiplayer) is - if it’s lightweight, Firebase works well; if it’s complex then go for something like AWS/GCP.

2 Likes