包阅导读总结
1. 关键词:
– ActivityPub
– 去中心化社交网络
– 社交内容格式
– 集成步骤
– 未来发展
2. 总结:
本文介绍了 ActivityPub 协议,包括其核心的活动流格式、软件映射方法、与联邦网络的连接步骤、常见问题及未来发展。强调其在去中心化社交网络中的作用,及开发者在集成时需注意的事项。
3. 主要内容:
– 背景介绍
– 提及 ActivityPub 作为 W3C 协议在去中心化社交网络中的兴起,尤其在马斯克收购推特后的发展。
– 理解活动流
– 介绍活动流规范是 ActivityPub 的核心,涵盖多种内容类型和“演员”。
– 说明活动包括社交网络中的各种操作。
– 软件与活动流的映射
– 规划集成的第一步是完成软件与活动流格式的映射。
– 举例说明不同软件功能的映射方式,提到可能存在的挑战及扩展词汇的方法。
– 连接到联邦网络
– 需为社交应用的各方面设置 RESTful API 端点。
– 介绍服务器支持的活动类型及请求的识别方式。
– 建议开发者熟悉 WebFinger 协议。
– 常见绊脚石
– 指出并非所有服务器支持所有活动类型。
– 提到内容和动作的交付可能延迟,需规划事件或排队处理器。
– 强调系统要为数据首次传输失败构建重试机制。
– 未来展望
– 强调 ActivityPub 是不断发展的标准。
– 提及正在开发的端到端加密消息和数据可移植性等新功能。
– 推荐开发者参与相关社区和门户。
思维导图:
文章地址:https://thenewstack.io/a-developers-guide-to-activitypub-and-the-fediverse/
文章来源:thenewstack.io
作者:Martin SFP Bryant
发布时间:2024/8/27 8:48
语言:英文
总字数:1428字
预计阅读时间:6分钟
评分:87分
标签:ActivityPub,去中心化社交网络,社交媒体,开发者指南,Activity Streams
以下为原文内容
本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com
If you keep an eye on developments in social media, you can’t have failed to notice the recent extraordinary rise of ActivityPub, a W3C protocol enabling decentralized social networking between federated servers.
What was once a somewhat niche protocol and open standard for building interoperable social apps has gained real traction in the wake of Elon Musk’s purchase, and subsequent transformation, of Twitter.
Mastodon is still the most significant implementation of ActivityPub, but as the benefits of social networks that aren’t centrally controlled by one company become an increasingly salient issue, more platforms have begun to integrate themselves into the ‘fediverse’.
The first step for planning an ActivityPub integration is to figure out how different aspects of your software map to the Activity Streams format.
– Evan Prodromou, ActivityPub spec co-author.
These include WordPress.com; Ghost; Flipboard, and Meta’s Elon-challenger, Threads.
If you want to understand the thinking behind ActivityPub, The New Stack recently explored the fundamentals in depth, in a podcast interview with co-author of the protocol, Evan Prodromou.
But how do you get started if you want to integrate your own software with ActivityPub? Prodromou has written a new book on this very topic, and we caught up with him to explore the practicalities of linking up with the fediverse.
Understanding Activity Streams
The W3C Activity Streams specification is at the core of how ActivityPub works. This format underpins the way the protocol handles social content.
While ActivityPub is best known for short-form text on platforms like Mastodon and Threads, it’s capable of supporting a much wider range of content types. These include:
- Longform text articles (e.g., WordPress.com, Flipboard, Ghost)
- Images (e.g., PixelFed)
- Video (e.g, PeerTube)
- Audio (e.g., Funkwhale)
- Forums (e.g., Lemmy)
In addition to content, Activity Streams handles “actors” in the network too. These are people who can do things, such as people, bots or brands.
But these objects are nothing without social activities to connect them.
“Activities are all the actions that we take in a social network, and those have a representation in the Activity Streams format. So for example, liking something generates a ‘like’ activity, and following someone is a ‘follow’ activity,” Prodromou says.
“We have activities for the full CRUD lifestyle — Create, Read, Update and Delete — as well as activities for adding things to a collection, removing them from a collection, geosocial information, event management, marketplaces… we have a lot of different activities.”
Mapping Your Software to Activity Streams
Prodromou explains that the first step for planning an ActivityPub integration is to figure out how different aspects of your software map to the Activity Streams format.
If you’re building forum software, then maybe forum posts can be mapped to the Article content type in Activity Streams. Maybe the comments of your forum posts could be Notes in Activity Streams (the content type used for short-form text).
“Activity Streams is an extensible vocabulary.”
While this mapping exercise is usually straightforward, Prodromou says that there can be challenges.
“Sometimes there’s not an easy mapping. So if you have, for example, a service for sharing models for 3D printers, we don’t have that built into ActivityPub. It’s not part of the basic standard. However, Activity Streams is an extensible vocabulary.”
This extensible vocabulary, he explains, means you can create new metadata types for your own content if it doesn’t map to existing formats.
Connecting to the Fediverse
Once you’ve mapped out how the various aspects of your social app line up with the ActivityPub standard, you need a RESTful API endpoint for each of them.
For example, other ActivityPub-compatible services will need a way of accessing user information such as name, bio, and picture from your service. Running with this example, Prodromou explains what’s required:
“You need to have input and output endpoints for your users. So if someone sends something to your user, you need to have a POST API endpoint that receives that information, called the user’s inbox. And it’s that inbox [which] is found on their user object. Then the outbox is where any activities that the user generates come out.”
“ActivityPub is not complete, and it may never be complete, because the way that people deal with social networks and social interactions is always changing.”
ActivityPub servers have a number of activities they need to support. These include following; accepting or rejecting a follow; creating, updating or deleting an object; adding something to a collection; removing it from a collection; blocking someone, and undoing any other activity.
“With that small toolset in your inbox handler, all of a sudden you’re participating as a full member of the fediverse,” Prodromou says.
The final thing to be aware of is that requests between AcitivityPub servers are identified using the IETF’s HTTP signatures protocol.
“This is a way that remote servers can send you something and identify what user it comes from,” Prodromou explains. “Your server can prove it really did come from that server, and can check it using public key cryptography… Most standard libraries can handle it.”
Prodromou also advises developers to familiarize themselves with WebFinger, the protocol that provides a simple, uniform identity system across the fediverse.
Common Stumbling Blocks
Prodromou says one aspect of ActivityPub that can prove tricky to developers is the fact that not all servers support all activity types.
For example, if your platform is built around event invitations, Mastodon users won’t see those invitations because Mastodon doesn’t support that kind of activity.
While you can contact the developers of other platforms and encourage them to support your favored activity type, they are under no obligation to do so. Prodromou encourages you to not worry too much, and accept that the diversity of the fediverse makes some incompatibilities inevitable.
“Different servers are going to have different profiles, and it’s okay if not everything gets to every user… It is a constantly evolving network, and there are new kinds of content on the network every day. It’s totally okay if we have different applications on the network, and maybe they don’t quite understand what each other is doing.”
Always include an event handler or queuing handler.
Another issue to be aware of is that delivering content and actions across the federated network can take time, especially if, for example, a particular user has a lot of followers. Prodromou says you should plan for this by including an event handler or queuing handler.
“Smaller applications sometimes don’t build that in, and you really need it for the fediverse… When someone’s loading a form or posting something, it takes too long and it’s going to stall out your UI or whatever. You really need offline handling.”
And finally, you should plan for the reality of the internet, where data doesn’t always get through the first time due to connectivity issues, brief maintenance downtime periods, and the like.
Building retries into your system for when data doesn’t get through the first time is essential for a fediverse application that runs reliably for users.
Looking to the Future
While building with ActivityPub, you should keep in mind that it’s an evolving standard and your users might well expect you to support new features as they’re introduced in the future.
“ActivityPub is not complete, and it may never be complete, because the way that people deal with social networks and social interactions is always changing,” Prodromou explains.
“There are kinds of social interaction on the web today that didn’t exist when we created ActivityPub, and there will be new kinds of interactions on the web 10 years from now that you and I can’t even imagine right now.”
Prodromou says he’s personally currently working on support for end-to-end encrypted messages, a feature that is rapidly becoming a table-stakes feature for messaging apps.
Data portability is another feature in the works for ActivityPub. This would allow a user to move their ‘home’ in the fediverse from, say, Mastodon to Threads, bringing all of their followers, followed accounts, activities, and content with them.
“The idea is really to keep it a living standard, something that is constantly catching up with cool new ways of interacting as human beings,” Prodromou says.
If you want to help shape the future of ActivityPub development and connect with other developers, Prodromou recommends you engage with the Social Web Incubator Community Group and the Fediverse Developer Portal.
Evan Prodromou’s new book ActivityPub: Programming for the Social Web is available now via the O’Reilly learning platform.
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don’t miss an episode. Subscribe to our YouTubechannel to stream all our podcasts, interviews, demos, and more.