Back
Close

Common patterns with Solid

Zwifi
1,891 views
Previous: Welcome

Managing notifications

In this exemple, you can get invited to Julius Caesar book release party. You may be 2000 years late, but cool people never show up on time anyway.

Discovering a resource's inbox

To find out where to reach any resource, all you have to do is ask! Inboxes are announced using the LDP term ldp:inbox in resources' RDF representation.

What is Cleopatra's inbox
const axios = require("axios")
const {fetch_inbox} = require("./discover-inbox")
// You can change that to your own webid
const resource_iri = "https://cleopatra.solid.community/profile/card#me"
// First, let's see the plain RDF representation of the resource
axios.get(resource_iri)
.then(response => {
// Let us just display the content of the resource
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Sending a notification

In the following snippet, after discovering the target's inbox, an invite is sent. Want to weasle your way in the coolest party of the Roman empire ? Just change the calendar_iri to your own!

Let's get crazy sending out invites
const axios = require("axios")
const $rdf = require("rdflib")
const {invite} = require("./invite")
const {fetch_inbox} = require("./discover-inbox")
const timeout = 3000
const LDP = $rdf.Namespace("http://www.w3.org/ns/ldp#")
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants