How to make a lobby attribute visible to members only?

As title, I want to have a lobby attribute which is visible to all members but not public for searching, etc

You can create a lobby attribute that is private. It won’t show up in search results, but will be visible to all lobby members. You can find this info here.

Lobby and lobby member attributes have public and private visibilities. In public visibility, data is visible to all members outside of the lobby for lobby attributes, and data is visible inside the lobby for lobby member attributes. Conversely, for private visibility, data is visible inside the lobby for lobby attributes, and data is visible to the member only for lobby member attributes.

Thanks Seb, Sorry I didn’t provide enough info I think. I’ve tried setting to private, but seems not working. Here’s what I do:

1. A creates lobby and sets attribute:

I’ve noticed that it’s not possible to provide lobby attributes at the time of creation. So first I create lobby with CreateLobby and then create a lobby modification object and finally call LobbyModification_AddAttribute to add my attribute to the lobby. I use private visibility for my attribute.

2. A sends invite to B

3.- B accepts invite from overlay:

Here in the AddNotifyLobbyInviteAccepted callback, B first does a call to CopyLobbyDetailsHandleByInviteId. Then call CopyAttributeByKey on the details object with the key for my attribute.

Now it returns nothing for my attribute. If I use Public visibitly in step 1 above, then I can retrieive my attribute fine.

First I said this is probably because I’m not a member of lobby yet (when calling CopyLobbyDetailsHandleByInviteId).

So I join the lobby successfully, then call the CopyLobbyDetailsHandle with the lobbyId to obtain the lobbyDetails object, and then call CopyAttributeByKey with my attribute key. But still get nothing if the visibility is private and I’m only able to retrieve my attribute on B side if visibility is public.

Can you try having the lobby owner (A) create the private lobby attribute after (B) has joined? (B) should get notified via the callback function set in EOS_Lobby_AddNotifyLobbyUpdateReceived that there is a new attribute on the lobby. I’ve never tested this, but I’m suspicious that the LobbyDetails that is locally cached on (B) doesn’t have the private attribute included as it’s the LobbyDetails that was returned in the search before (B) joined.

Just a friendly tip here when using the SDK. “Copy” functions in general retrieve data from a locally cached copy of the object. “Query” functions would retrieve the data from our backend to update the locally cached copy (which can then be retrieved using a “Copy” function). Other than QueryInvites, there’s no query function for lobby data as all the data should be updated automatically on peers via notifications. That said I figured this tip might be useful if you are using other APIs (like achievements, stats, etc…).

I think this is an edge case where the data doesn’t come up because it’s private and the player isn’t a member when the lobby data is first retrieved.

> Can you try having the lobby owner (A) create the private lobby attribute after (B) has joined?

This would not work for the flow that I want. I need the attribute that A sets be immediately available upon join.

> LobbyDetails that is locally cached on (B) doesn’t have the private attribute included as it’s the LobbyDetails that was returned in the search before (B) joined.

I don’t do a search. A creates lobby and sets the attribute. Only then it sends invite to B, so the lobby attribute has already been set before the invite is sent out.

Thanks for the tip about Query vs Copy. So does this mean that the LobbyDetails that I get from CopyLobbyDetailsHandleByInviteId before joining the session is exactly the same LobbyDetails that I get after successful join and calling CopyLobbyDetailsHandle? I thought when we join a lobby the SDK would automatically update the LobbyDetails to the latest version as things might have changed from the time invite was sent till the join happened.

If it’s not the case, how can I force the update of LobbyDetails? thanks

Yes, the LobbyDetailsHandle retrieves the cached data. You can find this information here.

That said, there is an odd behavior here, possibly 2 odd behaviors:

  1. Even after joining the lobby, if the owner creates a private attribute, members don’t see it. If you call EOS_LobbyDetails_CopyAttribute… EOS_NotFound is returned. This looks like a bug (unless our documentation is wrong and both private lobby and lobby member attributes can only be seen by the member who created them). I reproduced this using 1.17.
  2. I think we could argue that if private lobby attributes are meant to be visible to all lobby members (this is what the documentation currently states), they should be returned from CopyLobbyDetailsHandleByInviteId since the player was invited to the lobby.

I’m going to reach out to our SDK engineering team for some help here. Can you let me know if there is any urgency here? Are you approaching a deadline? Thanks!

Thanks Seb, ok it’s more complicated that looked initially. We do want to do our release on the end of March. Thanks for following this up!

Thanks for sharing your timeline. Is using a public lobby member attribute an option here? It will be visible to all lobby members, but not to players outside of the lobby.

Thanks Seb, yes it might work. The creator of the lobby can set that as it’s own attribute. One question, would that be available when we call CopyLobbyDetailsHandleByInviteId (i.e. before actually joining the lobby)?

No the member attribute would only be visible once the player has joined the lobby.

Thanks, that still works for us right now

Hey, sorry for the delay in responding. I spoke with the SDK and backend engineering team. Private attributes, both at the lobby and lobby member levels, are only kept locally on the client and are never sent to our backend. Our documentation was wrong. I worked with the tech writing team to update it, and the correct information is now reflected here. Sorry for the confusion and frustration caused here. Were you able to get your use case working with lobby member attributes?

Thanks for clarification Seb, yes the lobby member attribute should work if it works as you mentioned, but right now we haven’t tested it yet as pulled to other priorites. But I’ll test it soon