this post was submitted on 16 Jun 2023
13 points (100.0% liked)

Programming

13374 readers
2 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

Understanding ActivityPub and Federation

I have tried to understand how Federation works but I'm getting a feeling that there's some rather large gaps here. My first attempt was to find an API implementation in python, 3 wasted hours of my life later and I'm making requests.request() calls like it's 2007. And I still can't access the content as presented on the webinterfaces. There doesn't seem to be a way to access eg the communities tab via activitypub? Any Help?

@programming

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 year ago (2 children)

I'm not an expert, but based on my understanding the Communities tab (as well as things like your user profile) are special to Lemmy, and stored on a given Lemmy instance. ActivityPub basically provides a shared language for how various services/clients can ask for and send each other data (posts, comments etc) in a totally agnostic format. Lemmy renders this data as posts and comments, but Mastodon renders them as toots and so forth. And that's an oversimplification, because there's no guarantee that two pieces of software (Lemmy and Mastodon in this example) will operate with the same ActivityPub types, so the way content is displayed is inconsistent or possibly entirely incompatible. If you want to create a generic Fediverse reader, you would need to keep an up-to-date representation of every type that every common ActivityPub software uses for its content, which could work but I imagine would be quite tedious and prone to breaking. That being said, I was imagining something like this existing myself, and I suspect over time as different types become common "building blocks" for different types of social networks this will be more solidified and straightforward.

To your mention of content not being accessible from everywhere, it sounds like maybe you're expecting a centralized directory of information, but that's the big difference with true decentralization/federation. No single Lemmy instance know of every other Lemmy instance, they only know the ones they've talked to. All of the data is accessible if I know the hostname of a Lemmy instance, I just need to know the hostname first, and unless we build a centralized repository of every instance, we will never know of every single one. In the meantime, larger Lemmy instances have a large enough list of federated servers to get you most of the way there in terms of a directory, so maybe that's a reasonable stopgap.

[–] [email protected] 1 points 1 year ago (1 children)

You actually described my expectation in that last paragraph. I fully expected to have to invent a curated list of endpoints. What I instead found was that even given an endpoint (like beehaw.org) there is no way to discover what is on that instance. Which is a big issue. I've discussed this a bit (albeit extremely slowly) with the folks in the activitypub irc, and pretty much got it confirmed. If you want to develop a service that is intent on delivering any form of public content at all, supporting activitypub, then you have no protocol based way of communicating this content to anyone. So going by that the lemmy implementation is actually "correct", in as much as the protocol simply fails to provide guidance for this critical step.

[–] [email protected] 1 points 1 year ago

That's not really the protocol's job though. We use HTTP as the protocol for APIs on the web, but HTTP does not require any specific endpoints -- that's up to the application itself. Ultimately I think this is a pain point caused by the relative immaturity of the ActivityPub ecosystem, and over time I suspect the way that services define their APIs will become more uniform (likely with the help of libraries/interfaces that define common functionality or help bridge the gap between different implementations). In the meantime it's pretty rough going though, and we'll see if some big players joining the space (Meta is rumored to be working on a Twitter competitor using ActivityPub) help define de-facto standards to make it easier.