Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
We Distribute
  1. Home
  2. Technical Discussion
  3. I have deeply mixed feelings about #ActivityPub's adoption of JSON-LD, as someone who's spent way too long dealing with it while building #Fedify.

I have deeply mixed feelings about #ActivityPub's adoption of JSON-LD, as someone who's spent way too long dealing with it while building #Fedify.

Scheduled Pinned Locked Moved Technical Discussion
fedifyjsonldfedidevactivitypub
168 Posts 35 Posters 266 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mat@friendica.exon.nameM mat@friendica.exon.name

    @sl007 @julian I admit I didn't pay attention to immers at the time - I don't play games, not even chess. I was just using chess as an example, didn't mean to trigger anyone's trauma!

    Still, it kinda proves my point. You have to use standard AS vocabulary because Mastodon, and if you squint then sure, Travel and Arrive, why not? But given some of the conversations I've seen on this forum, I shudder to think how that would go down if you tried to get approval for that usage from "the community" first.

    sl007@digitalcourage.socialS This user is from outside of this forum
    sl007@digitalcourage.socialS This user is from outside of this forum
    sl007@digitalcourage.social
    wrote last edited by
    #21

    @mat Has a reason, just wrote it to @julian in a DM, just didn't want to post public.

    Not sure if you visited the link. This _was_ the community approval …
    Immers was famous and we had some official Social CG meetings where I linked one where thousands of community people attended (?)
    The W3C Social CG _is_ the Community (?)
    Meanwhile even Public Spaces Incubator uses it which is to my best knowledge the largest upcoming iimplementor by far.
    I mean apart from that it is pretty obvious after the meeting where we talked about "factual" vs "fictional".
    mastodon has nothing to do with this. The majority of projects count in a democracy. We had a demo playing chess between 4 softwares.

    Doing the official AP Conf and becoming elected Policy Lead, I had always asked the community. For 20 years 😞
    https://conf.tube/c/apconf_channel/videos

    Not sure if anyone did read the "Conformance Section" of ActivityPub. https://www.w3.org/TR/activitypub/#conformance
    It is section 2 - You have to support "The Entirety"...
    If mastodon does not it is not ActivityPub.

    1 Reply Last reply
    0
    • lkanies@hachyderm.ioL This user is from outside of this forum
      lkanies@hachyderm.ioL This user is from outside of this forum
      lkanies@hachyderm.io
      wrote last edited by
      #22

      @hongminhee @jalefkowit huh. I’ve been pondering using it for some projects of mine, so this is good to know.

      Is it a fundamental problem with JSON-LD, such that it should just be avoided, or a problem with how ActivityPub uses it?

      And is there something else you’d recommend that fulfills the same goals?

      hongminhee@hollo.socialH 1 Reply Last reply
      0
      • mat@friendica.exon.nameM mat@friendica.exon.name

        @sl007 @julian I admit I didn't pay attention to immers at the time - I don't play games, not even chess. I was just using chess as an example, didn't mean to trigger anyone's trauma!

        Still, it kinda proves my point. You have to use standard AS vocabulary because Mastodon, and if you squint then sure, Travel and Arrive, why not? But given some of the conversations I've seen on this forum, I shudder to think how that would go down if you tried to get approval for that usage from "the community" first.

        sl007@digitalcourage.socialS This user is from outside of this forum
        sl007@digitalcourage.socialS This user is from outside of this forum
        sl007@digitalcourage.social
        wrote last edited by
        #23

        @mat
        Just btw, this is 7 years old https://www.reddit.com/r/chess/comments/94ubnd/chess_over_activitypub/ but anyway

        However, given that I have, including immers and redaktor, at least 3 apps where I can use the first chess spec.:
        if more than 2 implementations will also support this second chess specification, I will do so too.

        @julian

        1 Reply Last reply
        0
        • lkanies@hachyderm.ioL lkanies@hachyderm.io

          @hongminhee @jalefkowit huh. I’ve been pondering using it for some projects of mine, so this is good to know.

          Is it a fundamental problem with JSON-LD, such that it should just be avoided, or a problem with how ActivityPub uses it?

          And is there something else you’d recommend that fulfills the same goals?

          hongminhee@hollo.socialH This user is from outside of this forum
          hongminhee@hollo.socialH This user is from outside of this forum
          hongminhee@hollo.social
          wrote last edited by
          #24

          @lkanies@hachyderm.io @jalefkowit@vmst.io To be honest, I'm not too sure myself. I just know that JSON-LD was originally planned as a foundation for the Semantic Web. I can only guess that if ontology is useful in a certain area, then JSON-LD would probably be useful there too.

          1 Reply Last reply
          0
          • evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.ca
            wrote last edited by
            #25

            @hongminhee do you use the activitystrea.ms module from npm? It takes a lot of the pain out.

            hongminhee@hollo.socialH 1 Reply Last reply
            0
            • evan@cosocial.caE This user is from outside of this forum
              evan@cosocial.caE This user is from outside of this forum
              evan@cosocial.ca
              wrote last edited by
              #26

              @hongminhee I agree that new developers should use a JSON-LD processor. It saves a lot of heartache.

              1 Reply Last reply
              0
              • evan@cosocial.caE evan@cosocial.ca

                @hongminhee do you use the activitystrea.ms module from npm? It takes a lot of the pain out.

                hongminhee@hollo.socialH This user is from outside of this forum
                hongminhee@hollo.socialH This user is from outside of this forum
                hongminhee@hollo.social
                wrote last edited by
                #27

                @evan@cosocial.ca I don't remember exactly, but I think I came across it while doing research before developing Fedify. I probably didn't use it because the TypeScript type definitions were missing. In the end, I ended up making something similar in Fedify anyway.

                1 Reply Last reply
                0
                • silverpill@mitra.socialS silverpill@mitra.social

                  @mariusor @hongminhee The @context is not supposed to be required in the first place, but here we are adding it to every activity and wasting bandwidth because Mastodon developers didn't read the spec.

                  mariusor@metalhead.clubM This user is from outside of this forum
                  mariusor@metalhead.clubM This user is from outside of this forum
                  mariusor@metalhead.club
                  wrote last edited by
                  #28

                  @silverpill I'm sorry, I'm not aware of that and I thought I read the specs pretty thoroughly. Could you point me in the right direction for where you got this information from?

                  @hongminhee

                  silverpill@mitra.socialS 1 Reply Last reply
                  0
                  • varpie@peculiar.floristV This user is from outside of this forum
                    varpie@peculiar.floristV This user is from outside of this forum
                    varpie@peculiar.florist
                    wrote last edited by
                    #29

                    @hongminhee I have the same feeling. The idea behind JSON-LD is nice, but it isn't widely available, so developing with it becomes a headache: do I want to create a JSON-LD processor, spending twice the time I wanted to, or do I just consider it as JSON for now and hope someone will make a JSON-LD processor soon? Often, the answer is the latter, because it's a big task that we're not looking for when creating fedi software.

                    1 Reply Last reply
                    0
                    • mariusor@metalhead.clubM mariusor@metalhead.club

                      @silverpill I'm sorry, I'm not aware of that and I thought I read the specs pretty thoroughly. Could you point me in the right direction for where you got this information from?

                      @hongminhee

                      silverpill@mitra.socialS This user is from outside of this forum
                      silverpill@mitra.socialS This user is from outside of this forum
                      silverpill@mitra.social
                      wrote last edited by
                      #30

                      @mariusor @hongminhee

                      @context is a recommendation, not a requirement.

                      ActivityPub:

                      Link Preview Image
                      ActivityPub

                      The ActivityPub protocol is a decentralized social networking protocol based upon the [ActivityStreams] 2.0 data format. It provides a client to server API for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and content.

                      favicon

                      (www.w3.org)

                      Implementers SHOULD include the ActivityPub context in their object definitions.

                      ActivityStreams:

                      Link Preview Image
                      Activity Streams 2.0

                      favicon

                      (www.w3.org)

                      Implementations producing Activity Streams 2.0 documents SHOULD include a @context property with a value that includes a reference to the normative Activity Streams 2.0 JSON-LD @context definition using the URL " https://www.w3.org/ns/activitystreams".

                      mariusor@metalhead.clubM 1 Reply Last reply
                      0
                      • silverpill@mitra.socialS silverpill@mitra.social

                        @mariusor @hongminhee

                        @context is a recommendation, not a requirement.

                        ActivityPub:

                        Link Preview Image
                        ActivityPub

                        The ActivityPub protocol is a decentralized social networking protocol based upon the [ActivityStreams] 2.0 data format. It provides a client to server API for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and content.

                        favicon

                        (www.w3.org)

                        Implementers SHOULD include the ActivityPub context in their object definitions.

                        ActivityStreams:

                        Link Preview Image
                        Activity Streams 2.0

                        favicon

                        (www.w3.org)

                        Implementations producing Activity Streams 2.0 documents SHOULD include a @context property with a value that includes a reference to the normative Activity Streams 2.0 JSON-LD @context definition using the URL " https://www.w3.org/ns/activitystreams".

                        mariusor@metalhead.clubM This user is from outside of this forum
                        mariusor@metalhead.clubM This user is from outside of this forum
                        mariusor@metalhead.club
                        wrote last edited by
                        #31

                        @silverpill aaah, I see. I think we've had this discussion before (or at least I had it with someone else).

                        For me "SHOULD" falls in the category of the robustness principle: "be conservative in what you do, be liberal in what you accept from others".

                        So for me if you treat "SHOULD" in a spec as non mandatory you haven't really implemented the spec.

                        @hongminhee

                        silverpill@mitra.socialS 1 Reply Last reply
                        0
                        • mariusor@metalhead.clubM mariusor@metalhead.club

                          @silverpill aaah, I see. I think we've had this discussion before (or at least I had it with someone else).

                          For me "SHOULD" falls in the category of the robustness principle: "be conservative in what you do, be liberal in what you accept from others".

                          So for me if you treat "SHOULD" in a spec as non mandatory you haven't really implemented the spec.

                          @hongminhee

                          silverpill@mitra.socialS This user is from outside of this forum
                          silverpill@mitra.socialS This user is from outside of this forum
                          silverpill@mitra.social
                          wrote last edited by
                          #32

                          @mariusor I don't remember having such discussion. The SHOULD keyword is defined in RFC-2119:

                          This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.

                          There are many valid reasons to not include @context. We also have almost 10 years of implementation experience and by now full implications are very well understood: by ignoring this recommendation we make messages smaller and developer experience better. No downside at all.

                          @hongminhee

                          mariusor@metalhead.clubM 1 Reply Last reply
                          0
                          • silverpill@mitra.socialS silverpill@mitra.social

                            @mariusor I don't remember having such discussion. The SHOULD keyword is defined in RFC-2119:

                            This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.

                            There are many valid reasons to not include @context. We also have almost 10 years of implementation experience and by now full implications are very well understood: by ignoring this recommendation we make messages smaller and developer experience better. No downside at all.

                            @hongminhee

                            mariusor@metalhead.clubM This user is from outside of this forum
                            mariusor@metalhead.clubM This user is from outside of this forum
                            mariusor@metalhead.club
                            wrote last edited by
                            #33

                            @silverpill regarding size, ActivityPub is such a verbose protocol that the hundred or so of raw bytes you save through omitting context, are most likely negligible through the prism of connection compression. So to me that's not entirely a "valid reason".

                            And as developer myself, I think that contexts, even in a non valid JSON-LD implementation, offer enough guidance for building a data vocabulary for them to have plenty of value.

                            Do you propose we replace contexts with Open API specifications, or how do we coordinate what's a valid vocabulary data object in a federated network? And how do you propose that others discover these specs?

                            @hongminhee

                            mariusor@metalhead.clubM 1 Reply Last reply
                            0
                            • douginamug@mastodon.xyzD This user is from outside of this forum
                              douginamug@mastodon.xyzD This user is from outside of this forum
                              douginamug@mastodon.xyz
                              wrote last edited by
                              #34

                              @pintoch read this thread?

                              1 Reply Last reply
                              0
                              • mariusor@metalhead.clubM mariusor@metalhead.club

                                @silverpill regarding size, ActivityPub is such a verbose protocol that the hundred or so of raw bytes you save through omitting context, are most likely negligible through the prism of connection compression. So to me that's not entirely a "valid reason".

                                And as developer myself, I think that contexts, even in a non valid JSON-LD implementation, offer enough guidance for building a data vocabulary for them to have plenty of value.

                                Do you propose we replace contexts with Open API specifications, or how do we coordinate what's a valid vocabulary data object in a federated network? And how do you propose that others discover these specs?

                                @hongminhee

                                mariusor@metalhead.clubM This user is from outside of this forum
                                mariusor@metalhead.clubM This user is from outside of this forum
                                mariusor@metalhead.club
                                wrote last edited by
                                #35

                                @silverpill personally I feel like the various activity/object signing methods that get used in recent FEPs are more egregious from a size point of view, when the in spec behaviour for obtaining canonical versions of a resource is to fetch them from their server, instead of relying on random object signing that introduces so much more friction.

                                @hongminhee

                                julian@activitypub.spaceJ 1 Reply Last reply
                                0
                                • mariusor@metalhead.clubM mariusor@metalhead.club

                                  @silverpill personally I feel like the various activity/object signing methods that get used in recent FEPs are more egregious from a size point of view, when the in spec behaviour for obtaining canonical versions of a resource is to fetch them from their server, instead of relying on random object signing that introduces so much more friction.

                                  @hongminhee

                                  julian@activitypub.spaceJ This user is from outside of this forum
                                  julian@activitypub.spaceJ This user is from outside of this forum
                                  julian@activitypub.space
                                  wrote last edited by
                                  #36

                                  @mariusor@metalhead.club I thought the whole point of signing objects or attaching proofs (none of which I do, mind you) are precisely to save the need to make a new request, which comes with its own overhead.

                                  The good thing is fetching from canonical source will never go out of style.

                                  cc @silverpill@mitra.social

                                  Aside, it seems like I'm only getting Marius's posts, not silverpills. Makes for an interesting one-sided exchange 😛

                                  silverpill@mitra.socialS 1 Reply Last reply
                                  0
                                  • julian@activitypub.spaceJ julian@activitypub.space

                                    @mariusor@metalhead.club I thought the whole point of signing objects or attaching proofs (none of which I do, mind you) are precisely to save the need to make a new request, which comes with its own overhead.

                                    The good thing is fetching from canonical source will never go out of style.

                                    cc @silverpill@mitra.social

                                    Aside, it seems like I'm only getting Marius's posts, not silverpills. Makes for an interesting one-sided exchange 😛

                                    silverpill@mitra.socialS This user is from outside of this forum
                                    silverpill@mitra.socialS This user is from outside of this forum
                                    silverpill@mitra.social
                                    wrote last edited by
                                    #37

                                    @julian I noticed that your inbox endpoint returns 404s (my activities are delivered to personal inbox, not shared).

                                    @mariusor

                                    liaizon@social.wake.stL 1 Reply Last reply
                                    0
                                    • kopper@not-brain.d.on-t.workK This user is from outside of this forum
                                      kopper@not-brain.d.on-t.workK This user is from outside of this forum
                                      kopper@not-brain.d.on-t.work
                                      wrote last edited by
                                      #38
                                      @hongminhee from the point of view of someone who is "maintaining" a JSON-LD processing fedi software and has implemented their own JSON-LD processing library (which is, to my knowledge, the fastest in it's programming language), JSON-LD is pure overhead. there is nothing it allows for that can't be done with

                                      1. making fields which take multiple values explicit
                                      2. always using namespaces and letting HTTP compression take care of minimizing the transfer

                                      without JSON-LD, fedi software could use zero-ish-copy deserialization for a majority of their objects (when strings aren't escaped) through tools like serde_json and Cow<str>, or
                                      System.Text.Json.JsonDocument. JSON-LD processing effectively mandates a JSON node DOM (in the algorithms standardized, you may be able to get rid of it with Clever Programming)

                                      additionally, due to JSON-LD 1.1 features like @type:@json, you can not even fetch contexts in parallel, meaning all JSON-LD code has to be async (in the languages which has the concept), potentially losing out on significant optimizations that can't be done in coroutines due to various reasons (e.g. C# async methods can't have ref structs, Rust async functions usually require thread safety due to tokio's prevalence, even if they're ran in a single-threaded runtime)

                                      this is
                                      after context processing introducing network dependency to the deserialization of data, wasting time and data on non-server cases (e.g. activitypub C2S). sure you can cache individual contexts, but then the context can change underneath you, desynchronizing your cached context and, in the worst case, opening you up to security vulnerabilities

                                      json-ld is not my favorite part of this protocol
                                      kopper@not-brain.d.on-t.workK sl007@digitalcourage.socialS cwebber@social.coopC 3 Replies Last reply
                                      0
                                      • kopper@not-brain.d.on-t.workK kopper@not-brain.d.on-t.work
                                        @hongminhee from the point of view of someone who is "maintaining" a JSON-LD processing fedi software and has implemented their own JSON-LD processing library (which is, to my knowledge, the fastest in it's programming language), JSON-LD is pure overhead. there is nothing it allows for that can't be done with

                                        1. making fields which take multiple values explicit
                                        2. always using namespaces and letting HTTP compression take care of minimizing the transfer

                                        without JSON-LD, fedi software could use zero-ish-copy deserialization for a majority of their objects (when strings aren't escaped) through tools like serde_json and Cow<str>, or
                                        System.Text.Json.JsonDocument. JSON-LD processing effectively mandates a JSON node DOM (in the algorithms standardized, you may be able to get rid of it with Clever Programming)

                                        additionally, due to JSON-LD 1.1 features like @type:@json, you can not even fetch contexts in parallel, meaning all JSON-LD code has to be async (in the languages which has the concept), potentially losing out on significant optimizations that can't be done in coroutines due to various reasons (e.g. C# async methods can't have ref structs, Rust async functions usually require thread safety due to tokio's prevalence, even if they're ran in a single-threaded runtime)

                                        this is
                                        after context processing introducing network dependency to the deserialization of data, wasting time and data on non-server cases (e.g. activitypub C2S). sure you can cache individual contexts, but then the context can change underneath you, desynchronizing your cached context and, in the worst case, opening you up to security vulnerabilities

                                        json-ld is not my favorite part of this protocol
                                        kopper@not-brain.d.on-t.workK This user is from outside of this forum
                                        kopper@not-brain.d.on-t.workK This user is from outside of this forum
                                        kopper@not-brain.d.on-t.work
                                        wrote last edited by
                                        #39
                                        @hongminhee take this part with a grain of salt because my benchmarks for it are with dotNetRdf which is the slowest C# implementation i know of (hence my replacement library), but JSON-LD is slower than RSA validation, which is one of the pain points around authorized fetch scalability

                                        wetdry.world/@kopper/114678924693500011
                                        fentiger@mastodon.socialF kopper@not-brain.d.on-t.workK 3 Replies Last reply
                                        0
                                        • silverpill@mitra.socialS silverpill@mitra.social

                                          @julian I noticed that your inbox endpoint returns 404s (my activities are delivered to personal inbox, not shared).

                                          @mariusor

                                          liaizon@social.wake.stL This user is from outside of this forum
                                          liaizon@social.wake.stL This user is from outside of this forum
                                          liaizon@social.wake.st
                                          wrote last edited by
                                          #40

                                          reposting so @julian sees this

                                          "I noticed that your inbox endpoint returns 404s (my activities are delivered to personal inbox, not shared)." says @silverpill

                                          julian@activitypub.spaceJ 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups