The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

chvetsov
2018-09-20 09:34:08

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

chvetsov
2018-09-21 09:59:54

@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

JohnTube
2018-09-24 14:32:16

Hi @Argentum_Manus,

Thank you for choosing Photon!

PUN works out-of-the-box with Photon Cloud using WSS (WebSocketsSecure).

I embedded it into my website and the game worked until I got to the point where I had to connect to photon server.
What do you mean by this? What errors do you see? Does your game work from Unity Editor first?

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)

Suraj
2021-09-02 06:38:54

hi, @chvetsov mod
can you please tell me how to create self - hosted server for webGL games using photon.

  1. I'm using Unity engine 2019 version
  2. photon pun 2 free version

chvetsov
2021-09-02 06:49:35

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

Back to top