Go-Fed: ActivityPub in Go(go-fed.org) |
Go-Fed: ActivityPub in Go(go-fed.org) |
I'm trying go-ap now and it's better in that I can jump in and use small parts of it, but it still could use more documentation.
Which parts of it are giving you trouble? I'm always open to answer questions to the project's mailing list: https://lists.sr.ht/~mariusor/activitypub-go
There is a rather hidden wiki that has some more information than strictly the comments in the code: https://man.sr.ht/~mariusor/go-activitypub/
If you are looking for examples, there is a reference server at https://github.com/go-ap/fedbox
Outside of that, any submission for documentation from your part would be greatly appreciated, like you already said, if you work with the specification for a long time it's sometimes difficult to put yourself in the shoes of someone new. I would greatly appreciate such a perspective.
Nothing in particular is giving me trouble. It's just that reading through fedbox (which I think is billed as a "simple" example) there's a lot going on and I don't know what exactly I'm looking at or where to start looking (though over time, especially after finding cs2.md, I'm starting to). The first hook for me was the definition of the "Service" actor, and I said "ah hah. so if I do this, but make it a Person, and fill in these attributes, it'll help me generate a json response of a Person actor" Then after spending time looking at errors with json.Marshal I realized that I need to be using jsonld.Marshal instead. That detail was never put in front of me. Then I had to dig through various repos to find how to add the "@context" fields. Right now I'm figuring out what exactly the Inbox and Outbox things do for me (maybe just generate a path?) And so on. I don't imagine this is how you want us to figure out how to use go-ap. Similar to the go-fed developer, it seems like you may not realize how much understanding you're taking for granted.
I think someone like me could benefit from a real stripped down example, no currying (pretty cool, never seen it before in Go, but a bit confusing), no layers of indirection, normal Go http handlers, the simplest database option. Let me do fancy abstractions in my own app once I learn how the libraries work. And/or a README that gives the lay of the land.
Does ActivityPub have a batching mechanism?
Imagine you are on server A and you have 3000 followers on server B. If you create a post do 3000 messages get sent to server B? Or just one?
> For servers hosting many actors, delivery to all followers can result in an overwhelming number of messages sent. Some servers would also like to display a list of all messages posted publicly to the "known network". Thus ActivityPub provides an optional mechanism for serving these two use cases.
[1] I guess you might make them for specific celebrities if your server has a high density of followers? grepping the Pleroma source doesn't seem to throw up any obvious "automatically make them" logic.
You mean that all followers of Celebrity X on instance Y will have a sharedInbox because they're a follower of Celebrity X? Apologies, I've only lightly read the spec and haven't really seen anything like this in there.
FedBOX was meant to be a "simple" example, but that was some years ago, and as these things go, I piled on work on it and now supports multiple storage backends, has its own oauth2 end points and storage, etc. I'm actively working on extracting from it the pieces that can be independent, to leave just the glue that combines the different parts of the library into a coherent and hopefully "simple" application.
Regarding your feedback, I'll act on making the wiki more visible and maybe make time to add some clarification why we need the separate jsonld package all together (which I thought it's implied because the ActivityPub specification states it in its first paragraphs). I guess I can clarify in the docs who the projects target: a go developer that wants to work in the fediverse space, has read a little from the specification but decided that code would be more understandable - which is I guess the point where I was at when I started them. :D
That part made sense once I read that fedbox puts it all together.
> extracting from fedbox to make simpler examples
Great!
> Read the specification
I have, maybe not carefully enough. I knew what jsonld was. I didn't notice at first that the structs in go-ap were annotated with `jsonld:"..."` rather than `json:"..."`. Perhaps jsonld.Marshal handles turning embedded objects into links? Otherwise I'm not sure what in the spec should have indicated to me that json.Marshal wouldn't work, since jsonld is still json.
When it comes to the Go the standard library implementation, that's not really the case. Go doesn't deal very well with the dynamic nature of the linked data. A lot of the architecture of go-ap has to deal with the fallout from this one issue. :(
On the wiki I mentioned before I wrote an explanation that goes over the problem a little more in depth: https://man.sr.ht/~mariusor/go-activitypub/go-ap/index.md#de...