link preview comments, formatting, documentation

This commit is contained in:
or-else
2024-12-03 20:45:24 +03:00
parent c2d61a6976
commit a5c55a1a3d
4 changed files with 115 additions and 86 deletions
+77 -61
View File
@@ -1,66 +1,67 @@
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
<!-- TOC depthfrom:1 depthto:6 withlinks:true updateonsave:true orderedlist:false -->
- [Server API](#server-api)
- [How it Works?](#how-it-works)
- [General Considerations](#general-considerations)
- [Connecting to the Server](#connecting-to-the-server)
- [gRPC](#grpc)
- [WebSocket](#websocket)
- [Long Polling](#long-polling)
- [Out of Band Large Files](#out-of-band-large-files)
- [Running Behind a Reverse Proxy](#running-behind-a-reverse-proxy)
- [Users](#users)
- [Authentication](#authentication)
- [Creating an Account](#creating-an-account)
- [Logging in](#logging-in)
- [Changing Authentication Parameters](#changing-authentication-parameters)
- [Resetting a Password, i.e. "Forgot Password"](#resetting-a-password-ie-forgot-password)
- [Suspending a User](#suspending-a-user)
- [Credential Validation](#credential-validation)
- [Access Control](#access-control)
- [Topics](#topics)
- [`me` Topic](#me-topic)
- [`fnd` and Tags: Finding Users and Topics](#fnd-and-tags-finding-users-and-topics)
- [Query Language](#query-language)
- [Incremental Updates to Queries](#incremental-updates-to-queries)
- [Query Rewrite](#query-rewrite)
- [Possible Use Cases](#possible-use-cases)
- [Peer to Peer Topics](#peer-to-peer-topics)
- [Group Topics](#group-topics)
- [`sys` Topic](#sys-topic)
- [Using Server-Issued Message IDs](#using-server-issued-message-ids)
- [User Agent and Presence Notifications](#user-agent-and-presence-notifications)
- [Trusted, Public, and Private Fields](#trusted-public-and-private-fields)
- [Trusted](#trusted)
- [Public](#public)
- [Private](#private)
- [Format of Content](#format-of-content)
- [Out-of-Band Handling of Large Files](#out-of-band-handling-of-large-files)
- [Uploading](#uploading)
- [Downloading](#downloading)
- [Push Notifications](#push-notifications)
- [Tinode Push Gateway](#tinode-push-gateway)
- [Google FCM](#google-fcm)
- [Stdout](#stdout)
- [Video Calls](#video-calls)
- [Messages](#messages)
- [Client to Server Messages](#client-to-server-messages)
- [`{hi}`](#hi)
- [`{acc}`](#acc)
- [`{login}`](#login)
- [`{sub}`](#sub)
- [`{leave}`](#leave)
- [`{pub}`](#pub)
- [`{get}`](#get)
- [`{set}`](#set)
- [`{del}`](#del)
- [`{note}`](#note)
- [Server to Client Messages](#server-to-client-messages)
- [`{data}`](#data)
- [`{ctrl}`](#ctrl)
- [`{meta}`](#meta)
- [`{pres}`](#pres)
- [`{info}`](#info)
- [How it Works?](#how-it-works)
- [General Considerations](#general-considerations)
- [Connecting to the Server](#connecting-to-the-server)
- [gRPC](#grpc)
- [WebSocket](#websocket)
- [Long Polling](#long-polling)
- [Out of Band Large Files](#out-of-band-large-files)
- [Running Behind a Reverse Proxy](#running-behind-a-reverse-proxy)
- [Users](#users)
- [Authentication](#authentication)
- [Creating an Account](#creating-an-account)
- [Logging in](#logging-in)
- [Changing Authentication Parameters](#changing-authentication-parameters)
- [Resetting a Password, i.e. "Forgot Password"](#resetting-a-password-ie-forgot-password)
- [Suspending a User](#suspending-a-user)
- [Credential Validation](#credential-validation)
- [Access Control](#access-control)
- [Topics](#topics)
- [me Topic](#me-topic)
- [fnd and Tags: Finding Users and Topics](#fnd-and-tags-finding-users-and-topics)
- [Query Language](#query-language)
- [Incremental Updates to Queries](#incremental-updates-to-queries)
- [Query Rewrite](#query-rewrite)
- [Possible Use Cases](#possible-use-cases)
- [Peer to Peer Topics](#peer-to-peer-topics)
- [Group Topics](#group-topics)
- [sys Topic](#sys-topic)
- [Using Server-Issued Message IDs](#using-server-issued-message-ids)
- [User Agent and Presence Notifications](#user-agent-and-presence-notifications)
- [Trusted, Public, and Private Fields](#trusted-public-and-private-fields)
- [Trusted](#trusted)
- [Public](#public)
- [Private](#private)
- [Format of Content](#format-of-content)
- [Out-of-Band Handling of Large Files](#out-of-band-handling-of-large-files)
- [Uploading](#uploading)
- [Downloading](#downloading)
- [Push Notifications](#push-notifications)
- [Tinode Push Gateway](#tinode-push-gateway)
- [Google FCM](#google-fcm)
- [Stdout](#stdout)
- [Video Calls](#video-calls)
- [Link Previews](#link-previews)
- [Messages](#messages)
- [Client to Server Messages](#client-to-server-messages)
- [{hi}](#hi)
- [{acc}](#acc)
- [{login}](#login)
- [{sub}](#sub)
- [{leave}](#leave)
- [{pub}](#pub)
- [{get}](#get)
- [{set}](#set)
- [{del}](#del)
- [{note}](#note)
- [Server to Client Messages](#server-to-client-messages)
- [{data}](#data)
- [{ctrl}](#ctrl)
- [{meta}](#meta)
- [{pres}](#pres)
- [{info}](#info)
<!-- /TOC -->
@@ -601,6 +602,21 @@ The `stdout` adapter is mostly useful for debugging and logging. It writes push
[See separate document](call-establishment.md).
## Link Previews
Tinode provides an optional service which helps client applications generate link (URL) previews for inclusion into messages. The enpoint of this service (if enabled) is located at `/v0/urlpreview`. The service takes a single parameter `url`:
```
/v0/urlpreview?url=https%3A%2F%2Ftinode.co
```
The first several kilobytes of the document at the given URL is fetched by issuing an HTTP(S) GET request. If the returned document has content-type `text/html`, the HTML is parsed for page title, description, and image URL. The result is formatted as JSON and returned as
```json
{"title": "Page title", "description": "This is a page description", "image_url": "https://tinode.co/img/logo64x64.png"}
```
The link preview service requires authentication. It's exactly the same as authentication for [Out of Band Large Files](#out-of-band-handling-of-large-files).
## Messages
A message is a logically associated set of data. Messages are passed as JSON-formatted UTF-8 text.