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

Please check if you can find an answer in our extensive documentation on Photon Server.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

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.

Fail to connect on local Photon Server with WebSocket

2021-08-25 17:34:47

I have a simple setup:

  • I have downloaded the server sdk v5 and it is running I have not modified the settings except for the NameServer.json where I changed the ipAdress to and the server is now running on my computer

  • On the same computer I have a Unity project with a simple scene that tries to connect to the server using "PhotonNetzork.ConnectUsingSettings()" with the following params:

Use Name Server: false
Fixed region: EU
Server: ws://
Port: 9090
Protocol: WebSocket

When I start the game inside the editor I get immediatly this error:
"ClientWebSocket IsFaulted: System.AggregateException: One or more errors occurred. ---> System.Net.WebSockets.WebSocketException: Unable to connect to the remote server
at System.Net.WebSockets.WebSocketHandle+d__28.MoveNext () [0x00107] in :0 (...)"

And everything work properly when I change the params to:

Use Name Server: false
Fixed region: EU
Port: 5055
Protocol: UDP

Am I doing something wrong or did I forget a step in order to make web socket work?
Any help would be much appreciated because I have been stuck with the server setup for a long time :(

Thanks in advance


2021-08-26 00:33:19

Hi @ClownCitron,

Thank you for choosing Photon!

Did you see this?

2021-08-26 10:00:01

Okay thanks a lot that's what I needed :)

But, now that I have been able to make the websocket connexion work on my local computer I have to make it work by SecureWebSocket to a remote server but I struggling a lot... I might be missing a step or something.

I have my Photon server runnning on a VPS which is linked with a domain name and I have followed the 5 steps from the doc:

I generated a certificate by Let's Encrypt with certbot and combined the key and the certificate into 'server.pem'.

In the PhotonServer.config I uncommented the following lines:



And now when I try to connect with my client (in the Unity Editor) with the following params I get an error:

Use Name Server: false
Server: wss://
Port: 19090
Protocol: WebSocketSecure

ClientWebSocket IsFaulted: System.AggregateException: One or more errors occurred. ---> System.Net.WebSockets.WebSocketException: Unable to connect to the remote server ---> System.OperationCanceledException: The operation was canceled. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
at System.Net.Sockets.Socket.BeginConnect (System.Net.IPAddress address, System.Int32 port, System.AsyncCallback requestCallback, System.Object state) [0x0001b] in :0
at System.Net.Sockets.SocketTaskExtensions+<>c.b__3_0 (System.Net.IPAddress targetAddress, System.Int32 targetPort, System.AsyncCallback callback, System.Object state) [0x00000] in :0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncImpl[TArg1,TArg2] (System.Func5[T1,T2,T3,T4,TResult] beginMethod, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, TArg1 arg1, TArg2 arg2, System.Object state, System.Threading.Tasks.TaskCreationOptions creationOptions) [0x00170] in <695d1cc93cca45069c528c15c9fdd749>:0

And I openned the following ports on Windows firewall: 19090,19091,19093.
Do I need to open other ports?

Any Idea of what step I might have forgotten or done wrong?


2021-08-26 10:05:49

And sorry I don't really understand..
Do I have to change something in the NameServer.json file?

Back to top