How to connect to photon with a webGL game?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How to connect to photon with a webGL game?
Argentum_Manus
2018-09-19 15:55:45
I have a webgl game, I embedded it into my website and the game worked until I got to the point where I had to connect to photon server.
My question is: Is there any specific ways I have to connect to photon with a webgl game?
(I am using Web Sockets Secure in my photon settings)
Comments
Hi, @Argentum_Manus
What client sdk are you using? What server sdk are you using?
best,
ilya
Argentum_Manus
2018-09-20 15:01:39
I was using unity webGL
@Argentum_Manus
what server sdk are you using self hosted or you try connect to cloud?
if you are using self hosted try connect to cloud first.
what type of websocket connection are you establishing? Secure or insecure? Secure are not supported out of the box by self hosted version. You need to install certificates and update configuration.
best,
ilya
Argentum_Manus
2018-09-21 15:23:36
I am connecting to the cloud with Unity Pun Free, and I am using a Secure websocket connection
Hi @Argentum_Manus,
Thank you for choosing Photon!
PUN works out-of-the-box with Photon Cloud using WSS (WebSocketsSecure).
What Unity version and what PUN version are you using?
Try out demos using WSS from Unity Editor in a fresh project and from a build and tell us if it works or not.
Argentum_Manus
2018-09-24 15:18:56
I am using the newest version of PUN and the game fully works with windows standalone and inside the editor. And I am using unity 2018.1.
As far as errors go, I don't see any, the game just doesn't connect to photon.
(I will reply later if the demos work when exported)
hi, @chvetsov mod
can you please tell me how to create self - hosted server for webGL games using photon.
- I'm using Unity engine 2019 version
- photon pun 2 free version
hi, @Suraj
there is not too much to say.
first setup and get it working with tcp or udp, than we non secure web sockets
and than with secure
using this page you can find information about certificate setup https://doc.photonengine.com/en-us/server/current/operations/certificate-setup
One important note is that bin_Win64/PhotonServer.config contains bug. Urls like Url="/*"
should be replaced by Url="/+"
best,
ilya