ChatClient Subscribe createOption

Options
Hi, I'm new to the photon. I would like to know why I got an error when I try to enable the createOption in subscribe ChatClient?
WS message: {
  type: 'utf8',
  utf8Data: '~m~62~m~~j~{"err":-6,"res":0,"msg":"Invalid subscribe request format"}'
}
time: Thu Jul 01 2021 02:49:27
error: Invalid subscribe request format(op 0)

Comments

  • qamir
    Options
    I use the existing code in the example.
    ChatDemo.prototype.demoSubscribe = function () {
            var pc = this.prevChannelsIds;
            var ids = DemoConstants.ChannelsToSubscribe.map(function (x) { return pc[x] || 0; });
            if (chatClient.subscribe(DemoConstants.ChannelsToSubscribe, { /* historyLength: 10 ,*/ lastIds: ids , createOptions: { publishSubscribers: true, maxSubscribers: 3}  })) {
                Output.log("[i]", "subscribing...");
                if (this.addFriends(DemoConstants.FriendList)) {
                    Output.log("[i]", "adding friends:" + DemoConstants.FriendList.join(","));
                }
            }
            else {
                Output.log("[i]", "error: subscribe send failed. [Connect] first?");
            }
        };
    
  • qamir
    Options
    I just fixed it. I passing the wrong format and now I can get it works normally but how do I get users list in the public channels or private?
  • Tobias
    Options
    The Publish Subscriber feature is not supported for JS clients at the moment.
    We have no ETA when this gets enabled (server side).
  • originalmoose
    Options
    Tobias wrote: »
    The Publish Subscriber feature is not supported for JS clients at the moment.
    We have no ETA when this gets enabled (server side).

    I feel like the javascript client subscribe method shouldn't accept options that wont work, and similarly the typescript definition shouldn't contain options that when used break the client.

    I did some playing around and as long as you create the channel (be the first to subscribe) from the c# client before connecting with a javascript client. The javascript client will work as you'd expect it to with publish subscribers enabled (subscribers object populated on the channel, events etc). Which makes me think this should be trivial to add to the server (the logic is in place, they payload just needs to be parsed correctly - which even a junior dev should be able to knock out pretty quickly).

    This feature is crucial to our use case as we need to be notified when a user is no longer connected to the channel. Admittedly this can be accomplished via something like sending out heartbeat messages, but since this is already being done it seems like a waste of bandwidth. Another option is setting up an api endpoint to create the channel using the c# client and hold the connection until someone else enters the room, but that is a ton of extra work and requires extra server resources to maintain the connection until a client connects, and if the client fails to connect the server would get stuck.

    It would be nice if this could be prioritized, it seems the javascript clients are rather neglected