URL unfurling is one of the names given to that funky thing that happens when you paste a web address into a post in Facebook (or other social network) and automatically get a preview of it – an image, the title and maybe some extract text.

This was a much requested technology that was sadly missing from Known for a long time, but for no longer!

In the latest builds you will automatically get URL unfurling occurring in status posts and likes/bookmarks. What’s more, you’ll get a URL preview when you’re editing your post.

Behind the scenes this tool makes use of a number of technologies, notably:

The Unfurling endpoint

This is an endpoint which is called by a client side javascript library.

When passed a URL, this endpoint will attempt to fetch and parse out header tags – title, open graph, facebook and twitter tags. It’ll also attempt to extract certain whitelisted OEmbed endpoints (currently only JSON endpoints are supported).

It will then render out in a pretty way – using oembed as preference, but if that’s not present (or not whitelisted) it’ll use Open Graph, and finally page title and description meta tags if nothing else is found.

Image proxy

If there is an image present in the open graph headers, this will be retrieved by a local caching image proxy. This proxy fetches and saves the image locally so that the remote site doesn’t get hit every time you refresh your page (this also helps protect your privacy).

Enjoy!

Sometimes it is desirable to execute actions in the background and periodic intervals. Building on from last week’s post, I wanted to spotlight a new feature, which uses the asynchronous event queue, to allow you to do this – the periodic execution (cron) service.

After completing the configuration step for enabling the Asynchronous Event Queue, you can then run the Known console periodic execution service:

./known.php service-cron

Once running, this service will periodically trigger an event to which code can listen to. Available events are cron/minute, cron/hourly and cron/daily.

While I’ve not really had a chance to talk about it recently, owing to being rather busy, there has been a lot of work done in Known core recently.

Known uses event queues to dispatch things like Webmention pings. By default, this dispatching is synchronous. However, an advanced feature that was recently added, was the ability to enqueue events and have them dispatched later in an asynchronous fashion, enabling faster page loading.

Configuring

As mentioned above, by default Known uses a synchronous event queue. To use something the asynchronous queue, add the following line to your config.ini:

event_queue = 'AsynchronousQueue'

Next, you need to run the Known event queue dispatching service using the Known console tool:

./known service-event-queue

Note: if you’re using per-domain configuration you’ll need to set an environment variable in order for everything to work as expected:

export KNOWN_DOMAIN='your.domain.name'

Enjoy!