Skip to content

Add websockets stream api docs - #1074

Merged
franklywatson merged 21 commits into
onflow:mainfrom
The-K-R-O-K:illia-malachyn/6644-new-websockets-stream-api-docs
Apr 21, 2025
Merged

franklywatson merged 21 commits into
onflow:mainfrom
The-K-R-O-K:illia-malachyn/6644-new-websockets-stream-api-docs

Conversation

@illia-malachyn

@illia-malachyn illia-malachyn commented Jan 7, 2025 •

Copy link
Copy Markdown
Contributor

Closes onflow/flow-go#6644

  • Added a single page overview docs
  • Added a multi-page detailed docs for each message type

This is in progress and is postponed till we finish with websockets epic. However, you can review it and write notes about it.

What to add to:

  • more examples with different parameters (after integration tests are finished)
  • rate limits (when all limits are discussed and implemented)

* Added a single page overiview docs
* Added a multi-page detailed docs for each
message type
@vercel

vercel Bot commented Jan 7, 2025

Copy link
Copy Markdown

@illia-malachyn is attempting to deploy a commit to the Flow Team on Vercel.

A member of the Team first needs to authorize it.

@illia-malachyn

illia-malachyn commented Jan 7, 2025 •

Copy link
Copy Markdown
Contributor Author

@vercel

vercel Bot commented Jan 10, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 4:23pm

@franklywatson
franklywatson marked this pull request as ready for review January 11, 2025 02:04
@franklywatson

Copy link
Copy Markdown
Contributor

@illia-malachyn the deployed vercel from a few days ago is here.

With the left nav we probably want a top label that is more readable than "websockets-stream-api". This nav option is also distinct from the written title of 'Websockets Stream API'. My guess is the intention was for the sub pages to be under that root, not the 'websockets-stream-api' one

Screenshot 2025-01-13 at 11 26 32 AM Screenshot 2025-01-13 at 11 23 54 AM

@franklywatson

franklywatson commented Jan 15, 2025 •

Copy link
Copy Markdown
Contributor

Nav looks good in latest vercel deployment. Looks like there's still more to be added and we should wait to merge this only once the functionality is deployed and live.

@franklywatson franklywatson linked an issue Jan 29, 2025 that may be closed by this pull request
@franklywatson

Copy link
Copy Markdown
Contributor

@illia-malachyn you will need to merge from main since the project structure for the docs in this area changed.

Also, we need to make sure this section is also updated: https://developers.flow.com/networks/access-onchain-data#subscriptions

@Guitarheroua

Copy link
Copy Markdown
Contributor

@illia-malachyn you will need to merge from main since the project structure for the docs in this area changed.

Also, we need to make sure this section is also updated: https://developers.flow.com/networks/access-onchain-data#subscriptions

Created separate issue #1150 to fix the last part you mentioned, as I see we do not have any description of new gRPC subscriptions and do not mark the old implementation as deprecated.

@peterargue peterargue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a few more comments. otherwise this is good

Guitarheroua and others added 2 commits February 27, 2025 12:46
Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
@Guitarheroua

Copy link
Copy Markdown
Contributor

added a few more comments. otherwise this is good

@peterargue fixed all remarks.

Comment thread docs/networks/access-onchain-data/websockets-stream-api/subscribe-topics.md Outdated
Comment thread docs/networks/access-onchain-data/websockets-stream-api/subscribe-topics.md Outdated
@illia-malachyn

Copy link
Copy Markdown
Contributor Author

We need to add a page with common error codes and maybe examples so that clients can handle them properly

@illia-malachyn

illia-malachyn commented Mar 10, 2025 •

Copy link
Copy Markdown
Contributor Author

As we are polishing websockets and some errors may come up, I'd recommend you write an automated subscription script for every topic. By doing this, we could run all of them after each bugfix and see we didn't break anything in case integration tests don't cover some logic. This would work as an additional layer of testing as well as future documentation for clients.

Here's a small example you can use https://github.com/The-K-R-O-K/flow-stream-api-example/blob/main/template.js
You can commit every subscription request there.

I image sth like that:

examples/
  blocks/
    from_start_height.js
    from_start_id.js
    from_latest_block.js
    wrong_args.js
    handle_errors.js
  events/
    ...

Despite the fact that this is out of the scope of this issue and we have a separate issue for it. I can see no reason why to not do it right now. It is faster than testing websockets manually.

Comment thread docs/networks/access-onchain-data/websockets-stream-api/subscribe-topics.md Outdated
@Guitarheroua

Copy link
Copy Markdown
Contributor

As we are polishing websockets and some errors may come up, I'd recommend you write an automated subscription script for every topic. By doing this, we could run all of them after each bugfix and see we didn't break anything in case integration tests don't cover some logic. This would work as an additional layer of testing as well as future documentation for clients.

Here's a small example you can use https://github.com/The-K-R-O-K/flow-stream-api-example/blob/main/template.js You can commit every subscription request there.

I image sth like that:

examples/
  blocks/
    from_start_height.js
    from_start_id.js
    from_latest_block.js
    wrong_args.js
    handle_errors.js
  events/
    ...

Despite the fact, that this is out-of-scope of this issue and we have a separate issue for it. I can see no reason why to not do it right now. It is faster than testing websockets manually.

Yeah, it makes sense. Would agree with you, that that will add an extra layer of testing from the client perspective

@franklywatson

franklywatson commented Mar 12, 2025 •

Copy link
Copy Markdown
Contributor

Looking good guys thanks! Maybe just a couple of nits left to address above?

If we speak about one small postman example with a simple request on a separate page - I don't mind

Yeah, for postman just one simple example would do. Then I can add an AWS example next to it @illia-malachyn

@Guitarheroua

Copy link
Copy Markdown
Contributor

Looking good guys thanks! Maybe just a couple of nits left to address above?

If we speak about one small postman example with a simple request on a separate page - I don't mind

Yeah, for postman just one simple example would do. Then I can add an AWS example next to it @illia-malachyn

@franklywatson Done it. Added "Postman UI example" and "Common errors" pages.

@franklywatson

Copy link
Copy Markdown
Contributor

Thanks guys, looks good @illia-malachyn @Guitarheroua . I think we're done here! Once we've released the functionality will merge this

@franklywatson franklywatson changed the title Add skeleton for new websockets stream api docs Add websockets stream api docs Mar 13, 2025

@peterargue peterargue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple small comments, but otherwise this looks good.

one I think is a change we should make in the error handling implementation.

Comment thread docs/networks/access-onchain-data/websockets-stream-api/common-errors.md Outdated
Comment thread docs/networks/access-onchain-data/websockets-stream-api/common-errors.md Outdated
Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
"topic": "account_statuses",
"payload": {
"block_id": "ab20d1a3574177e69636eea73e7db4e74cffb2754cb14ca0bf18c2b96e8b68b9",
"height": "106219247",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a timestamp?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint does not have a timestamp in the gRPC version, and as we use the same functionality inside Websockets, this does not have it either. Should it be present? If yes, I could create an issue for this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if we could add one here to synchronize with the data returned by the events topic, that would be awesome. Thanks @Guitarheroua

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue for this onflow/flow-go#7176

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@illia-malachyn illia-malachyn Mar 25, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jribbink we'll probably postpone the implementation of this though. can u leave a comment in the issue explaining why it matters to you?

@jribbink jribbink Mar 25, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not critical, it was just a suggestion so that consumers can have access to the same data through the account_statuses topic as they do through events (as all of the other data here is matching and these statuses are derived from events). But obviously if there's significant effort associated it's not necessary at all.


```json
{
"action": "list_subscriptions"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@illia-malachyn illia-malachyn Apr 17, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! Good catch!
I opened a PR onflow/flow-go#7317

This branch was successfully deployed

1 active deployment
Preview — 05a8f9b0 Deployed Mar 14, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Access] Add documentation for new websockets [Access] Add examples for ws conn usages

8 participants