Photon Chat Javascript SDK

Hi!

I have a game developed in Unity that uses Photon Chat.

I would like to have a chat client on web, so I can connect to the game's chat and interact with players. I can do it opening the Unity editor (or the game), but I want to connect from any browser.

I have downloaded the Photon Javascript SDK, and did some changes to the chat demo included. I am able to connect to the game's chat, and see the messages from players.

However, after a while, the server disconnects me and these errors appear:
Error 1001 Master peer error
Error 1004 Master peer error timeout


I understand these errors appears because I do not do nothing to keep the connection alive.

In Unity I call chatClient.Service() everyframe to keep the connection alive, but I cannot use it in Javascript.

In the class definition on Photon-Javascript_SDK.js it says:
@borrows Photon.LoadBalancing.LoadBalancingClient#service

However, when I call chatClient.Service() the javascript console tells me: "Uncaught TypeError: chatClient.Service is not a function"

How can I keep the connection alive?

Thanks in advance for your help!!

Comments

  • Update on this issue:

    I think I have found a workaround.

    Instead of calling chatClient.Service(), I call setUserStatus every 1 second to keep the connection alive:

    Is anyone else has this problem, just add this piece of code at the end of the chat demo.

    window.setInterval(function () {
    chatClient.setUserStatus(1, "", true);
    }, 1000);

  • Thanks for posting your workaround and the bug report.
    Our JS developer is on vacation now but when he's back, he will fix things.
  • JS Chat client does not require calling service().
    Does same happen with chat demo from sdk package? How long it takes to get disconnected?