Giter Site home page Giter Site logo

ably / docs Goto Github PK

View Code? Open in Web Editor NEW
20.0 31.0 41.0 235.64 MB

Ably Realtime API documentation

Home Page: https://ably.com/docs

License: Apache License 2.0

HTML 1.24% JavaScript 18.11% Shell 0.44% Procfile 0.01% TypeScript 77.20% CSS 2.49% MDX 0.51%

docs's Introduction

Ably Documentation

Ably is the platform that powers synchronized digital experiences in realtime. Whether attending an event in a virtual venue, receiving realtime financial information, or monitoring live car performance data – consumers simply expect realtime digital experiences as standard. Ably provides a suite of APIs to build, extend, and deliver powerful digital experiences in realtime for more than 250 million devices across 80 countries each month. Organizations like Bloomberg, HubSpot, Verizon, and Hopin depend on Ably’s platform to offload the growing complexity of business-critical realtime data synchronization at global scale.

New Toolchain: Gatsby Documentation Repository

This is a static site generated using Gatsby and documentation written in:

Run

Install node & yarn.

If you use ASDF or compatible tooling to manage your Ruby runtime versions, we have included a .tool-versions file - where the dependencies within can be installed with asdf install from the project root.

At the time of writing, this project requires Ruby 3.0.0, which in turn requires [email protected]. Environments with different versions (i.e. openssl@3) may experience a failing Ruby install, in which case you can do the following (and if this fails, uninstall @openssl@X first):

brew install [email protected]
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" asdf install ruby

yarn

If Gatsby CLI is not already installed:

yarn global add gatsby-cli

Environment variables setup

If you have not yet set up your local .env.development environment variables, run:

yarn develop:env-setup

Editors:

yarn edit

Developers:

To develop locally run:

yarn develop

Visit localhost:8000 for homepage.

Visit localhost:8000/docs/${relativePath} for documentation pages, e.g. localhost:8000/docs/client-lib-development-guide/documentation-formatting-guide.

To build and serve locally:

yarn rebuild

Visit localhost:8000 for homepage.

Redirects

Redirects are currently implemented using Gatsby's in-built redirect functionality.

To set up a redirect, add the following to the frontmatter of the page that you want to be the destination of the redirect:

redirect_from:
  - /redirect-from-this-path/

You can also add a single redirect, however while this is supported it is not the principal way to add redirects; adding a YAML array, as shown above, is the most stable and predictable way to add a redirect.

redirect_from: /redirect-from-this-single-path/

If a redirect is not already prepended with /docs, /docs will be prepended to the redirect source URL; if you need a redirect from the main website to a docs page, Gatsby currently cannot handle this.

Otherwise, the redirect will be left intact.

Redirects added in this way are also added to a file at ./config/nginx-redirects.conf, and used to create a map of nginx redirects at build time.

Other one-off instances of redirects may be added to additional config files, and imported in a similar way. See:

  • ./config/website-redirects.conf
  • ./config/client-lib-development-guide-redirects.conf
  • ./config/nginx.conf.erb

For how to create and include these redirects.

Images

Wherever possible, images should live in src/images and not in static/images. The authors of Gatsby recommend importing images into components. The static folder in Gatsby is an escape hatch for the rare cases where files cannot be imported.

The benefit of sticking to the Gatsby approach is that our images get processed and optimized during build time. It also allows us to serve our images over a CDN which is much better for our users.

Images in components

Images in components can be imported and rendered as follows:

import myImage from 'src/path/to/my-image.png';

export default Component => (<img src={myImage} />);

Images in YAML data

TBD

Images in textfile files

For rendering images in Textfile we have a special convention.

Firstly, place the image file in src/images/content. The in the textile files reference it with a special path @content, for example:

<img src="@content/path/to/image.png" />

The above will render the image at src/images/content/path/to/image.png.

Content images in textile is powered by ContentImagesProvider and useContentImages. Templates rendering content need to add the following to their GraphQL queries to get all the images loaded before passing it to the ContentImagesProvider:

  images: allFile(filter: { relativeDirectory: { glob: "content/**" } }) {
    nodes {
      ...ContentImage
    }
  }

Environment Variables

Note that any env variables needed to show in the browser must be prefixed with GATSBY_ in order to appear.

  • GATSBY_DOCS_SIGNED_IN - set to any string to force APIKeyMenuSelector & MultilineCodeContent to behave as though you are logged in
  • GATSBY_ABLY_MAIN_WEBSITE - the URL from which basic user data and API keys can be retrieved, and from which we can generate sitemap links and so on

GATSBY_ABLY_MAIN_WEBSITE can also be changed to point to staging or a local running website instance.

Place these in .env.development to run locally.

Further Information

Documentation is included throughout this repository in the form of README.md files at folder level. These are intended to:

  1. Aid navigation through the repository, so documentation contributors and developers can easily see if they are in the right place
  2. Support documentation contributors in understanding the expected results from their work
  3. Explain the thinking behind the application structure and conscious choices made, so that improvements can be made with increased confidence when a wrong choice has been made
    1. Ensure that where there is an alternative option, especially an obvious alternative option, the reasons for not selecting that option are made clear
  4. Support new & external developers in quickly understanding how separate parts of the application are expected to work

We have selected folder-level README files instead of the alternative of a dedicated documentation folder because we think it enables points 1 and 4 more directly, especially with the support from GitHub. The aim is to make browsing the repository much more clear even if you have no context for the repository.

Optional Setup Steps

If you would like to run linting and tests automatically before every commit and run yarn install automatically after every branch checkout, run yarn repo-githooks. If you would like to remove this behaviour, run yarn no-githooks.

To understand the data ingestion and parsing steps, please check the READMEs in the /data folder.

Help and contact

If you have any questions or suggestions, please get in touch.

docs's People

Contributors

aleksandar-r avatar aralovelace avatar axefrog avatar ben-xd avatar cjbatin avatar denissellu avatar dependabot[bot] avatar dpiatek avatar fliptopbox avatar franrob-projects avatar gregholmes avatar jamiehenson avatar kennethkalmer avatar lawrence-forooghian avatar m-hulbert avatar marto83 avatar mattheworiordan avatar mymmij avatar owenpearson avatar paddybyers avatar quintinwillison avatar samuelayo avatar sapples avatar simonwoolf avatar snikidev avatar srushtika avatar stevenappleby avatar tbedford avatar tcard avatar tomczoink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs's Issues

Spec for queued messages following a reconnect

Scenario as follows:

  1. Client connects
  2. Client attaches to channel bacon
  3. Client publishes 5 messages to bacon
  4. Transport disconnects, and client automatically tries to reconnect
  5. Whilst reconnecting the developer publishes 5 more messages to the bacon channel, and another client publishes 3 messages to the bacon channel.
  6. Client reconnects, but is unable to resume, so detaches all channels

Question:

  • Should the queued messages for the channel that is not attached fail those messages as the channel is now failed?
  • Could we publish the messages anyway when we introduce the functionality to publish without being attached?

@paddybyers WDYT?

Client library developer docs

Encoding / decoding rules should be documented for client library developers

For example:

JSON format

String payload -> encoding = ""
Binary payload -> encoding = "base64"
JSON payload -> encoding = "json"
Cipher JSON payload -> encoding = "json/utf-8/cipher+aes-128-cbc/base64"

MSGPACK format

String payload -> encoding = ""
Binary payload -> encoding = ""
JSON payload -> encoding = "json"
Cipher JSON payload -> encoding = "json/utf-8/cipher+aes-128-cbc"

Improve code example syntax

Instead of

bc[lang]. # first line must be here
# second line

Line break above causes code block to end

We should be able to use

```lang
 # first line

 # line break above is allowed
```.

Update client library spec sheets

Once #64 is finalise, update the spec spreadsheets with the recent batch of refinements to the spec. Also need confirmation on when ConnectionDetails wildcard is supported.

Versioning

We don't currently support versioning in the documentation.

Once all libraries reach 0.8 compatibility, we will need to review how we can publish updates to the docs, but allow people to access older versions.

@paddybyers, @SimonWoolf and @kouno FYI, something to think about in the near future.

Change {{API_KEY_ID}} to {{API_KEY_NAME}}

Better to use the naming convention of {{KEY_NAME}} and {{KEY_SECRET}} for the two parts either side of the : of API keys. This will need to be updated on the website once rolled out.

Update REST API docs

There are other features of the rest API that I think are also not in the docs, eg
?fields= (see Using-the-Admin-API#fields)
?select= (see Using-the-Admin-API#select)
?flatten= (see Using-the-Admin-API#flatten)

In getting the java library to run on Android I've run into the issue that the base HTTP primitive (HttpURLConnection) doesn't give you access to the response body in the case that:

  1. the statusCode is 401 or 407; and
  2. there is a request body (usually POST).

The reason is that under these circumstances the request body upload is forcibly terminated by closing the connection, and that in turn means that the response body is not read.

Response headers are available (and really do have to be, because otherwise WWW-Authenticate challenges would not work) so I've added the following headers to all error responses:

X-Ably-ErrorCode
X-Ably-ErrorMessage

These (with the statusCode) mean that a full error object can be constructed even if the response body is lost. (These are present for all error responses irrespective of method, where the error comes from the realtime system; but obviously not for errors arising downstream such as the loadbalancer.)

Document any and all limits

For example, how long we retain messages when a connection is dropped, or how many messages can be retained by the connection state on a frontend, total messages per second, message size etc.

┆Issue is synchronized with this Jira Task by Unito

Spec behaviour messages published before a resumed connection

@paddybyers please see ably/ably-ruby@23877d5#diff-5a92463d6ab8ad3fc8cf8aff5cfde6f8R573

I have implemented a new feature in the Ruby library following a discussion with Peter a few days ago as follows:

  • Connection is opened
  • Message is published over the transport
  • The transport is disconnected
  • The connection is resumed with a new transport
  • The message ACK has not yet been received because the transport was disconnected beforehand, so the client library resends the message and gets an ACK

I would like your view on whether this is the correct behaviour. The alternative is to fail the message that was sent, but that does not feel right given it was actually sent successfully.

Document ability to change the defaults and lower the defaults

  • Retry immediately if a connection disconnects from a connected state
  • Retry every 15s whilst in the disconnected state
  • Moves to suspended state within 2 minutes
  • Retry every 30s whilst in the suspended state
  • Review the fallback strategy when connection fails because of network or server issues
  • Allow defaults to be reconfigured before instancing the library, with a defaults option.
  • Add REST request timeout

Include architecture overview for each client library

In the overview section for each client library, we should provide an architecture overview so that developers understand the principles behind the design of the library. For example, in Java it is threaded, in Ruby it relies on EventMachine, and Go uses Mutexes, Go routines & Channels. This overview should be replicated in the client library READMEs as well.

Review realtime features

@paddybyers and @kouno finally completed the spec for both realtime & REST, see http://docs.ably.io/client-lib-development-guide/features/

Please can you review and fixup any issues you foresee or add your comments here and I will amend. If you notice anything missing please add too.

I will be using this as a check list for all client library developers to confirm what amount of functionality exists and is tested in each client library, so it's important we get this right as it will into a Google Doc with a list to code to prove the feature is implemented.

Terminology clean up

Whilst working through the documentation today, I found that referring to clients that have a clientId as authenticated clients could be very confusing for users. This is probably because being authenticated has no relation to your authentication with Ably via a token or API key, and the word authentication exists in Basic Authentication as well.

Having had a quick chat about this, @paddybyers and I came up with the following suggestion, which should not have any impact on the client libraries fortunately, but will simply be rolled out in our documentation.

@SimonWoolf and @lmars, do you have any objections or suggestions to improve this terminology?

Authentication

The process of providing credentials to Ably in the form of a token or API key, which in turn allows you to communicate with Ably if the credentials are valid.

Authorisation

Ably is responsible for authorising or refusing operations for the authenticated client based on the permissions specified within the API key and/or Token provided when the client authenticated.

Identified Client

Any client that has connected to Ably and has either explicitly provided a clientId when instancing the library, or implicitly been assigned a clientId following token authentication, will then assume and be restricted to that clientId for all operations. As our customers are responsible for issuing tokens or token requests themselves, and we recommend that they only use token authentication and never share their private keys with clients, an identified client publishing or present on a channel with the clientId given in their token can therefore be trusted by other clients.

Review needed

@paddybyers and @kouno, please can you review my changes in the docs repo over the last few days, see 8a62a69...source

The biggest chunks of work are:

  • Reorganisation of the client library developer guide sections with lots of new content
  • Support for wider variable interpolation within code examples
  • Update of out of date documentation include Authentication, WebSocket & Comet transports, Encryption, Real-time Protocol, REST API etc. I am focussing on this now because I want to help client lib developers by having docs that are up to date. @paddybyers especially, please can you review my changes as it's quite likely there are still parts that are wrong. I am less worried about missing docs however quite worried if the docs are wrong.
  • I set up the Quick Start Guide as a test to see if I could get the "Try it" live code editor working again properly with our JSBin. This all works now and the workflow is actually quite easy, you can either work in repo itself and the changes to JSBin are pushed up live when running guard, or you can edit in JSbin and then export back to docs by appending .textile to the URL in JSBin.

Please can you review these changes as soon as possible as I will be telling all client library developers that the documentation in those sections is now mostly up to date.

@kouno we are also now ready to get going with integrating our examples into the docs repo.

Question about RTP8g (presence#enter on a DETACHED channel)

So RTP8g says that the client lib, for Presence#enter, Raises an exception if the channel is DETACHED or FAILED.

This seems inconsistent with other actions that trigger an implicit attach (eg channel#publish), for which the client lib triggers an implicit attach for a detached channel just as for an initialized one. Presence#enter is the only action that has both an Implicitly attaches to the channel if not attached and a Raises an exception if the channel is DETACHED or FAILED requirement (the only other action that has the latter is Presence#get, which does not have an implicit attach requirement).

Current client lib behaviour: ably-js treats detached and initialized channels the same for all of these, and implicitly attaches. Ably-ruby has all presence broadcast-type actions raising an exception if called on a detached channel.

Not obvious to me why implicit attaching should behave differently between presence actions and others.

(Also for realtime presence#get: if we don't want to make it an implicit-attach action, shouldn't it raise an exception if in any state other than attached, not just detached or failed?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.