Skip to content

Introduce the Waku API's subscribe function (+ refactor waku_api.md)#86

Merged
fcecin merged 14 commits intomasterfrom
waku-api/subscribe
Feb 9, 2026
Merged

Introduce the Waku API's subscribe function (+ refactor waku_api.md)#86
fcecin merged 14 commits intomasterfrom
waku-api/subscribe

Conversation

@fryorcraken
Copy link
Contributor

@fryorcraken fryorcraken commented Oct 3, 2025

Description

This PR introduces subscribe and unsubscribe APIs to the Logos Messaging API spec.

This PR also provides an initial refactor of the waku_api.md spec file as part of merging master into this PR.

Notes:

JavaScript implementation of subscribe/unsubscribe: logos-messaging/logos-messaging-js#2667

Copy link
Contributor

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!
Just added some nitpicks that I hope you find useful
Cheers!

Examples of irremediable failures are:

#### Type definitions
- Invalid content topic format
Copy link
Contributor

Choose a reason for hiding this comment

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

This error can be returned straight away and doesn't require an event.
In fact, the majority of errors can be given in a result. Nevertheless, I think is nice keeping the subscr-error event in case is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comes from the mismatch between the C FFI API incarnation of this IDL spec and the e.g. Nim (or Rust etc.) incarnation of the API. In the C version everything returns void and responses are events, even if they can be given immediately (I think that's how the current C "kernel API" interface works?).

We can change everything here to be aware of sync results (return a proper struct type in a resut<> and minimize the use of events when they know they can have a sync response.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done. I deleted the subscription event source for now, we can reintroduce it if it's actually needed. But I don't think it is, since the app will already get a health status change notification for each content topic (a subscribed topic is immediately "not healthy," but once connections for it are verified, it should fire the sequence of health upgrade events).

parameters:
- name: waku
type: WakuNode
description: "The node to check for a binary connectivity status."
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't quite fully get this api's purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just the retconned spec of the checkApiAvailability function that's already in waku/api/api.nim, which answers the simple question of whether it makes basic sense to even attempt to e.g. spawn a message sending task right now or whether it should be immediately bounced off until the node connectivity situation improves (also checks for nil together with the Disconnected state check).

This can be moved off of the API (public, product interface) and be used internally by the Send API implementation only, but I think it's good to expose this in the API.

The full Health API spec is not here yet, but once the Health API PR is merged, I'll open a PR to update the spec here with all the LMN API functions that will already be supported.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can adopt a more conservative approach and hide as much API as possible. If that can be tackled by the SendAPI I think is better to move it off for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Deleted checkApiAvailability, we can figure out where to move stuff to in the code later.

Maybe we should align waku/api/* specifically to stuff that ultimately makes its way into this spec only. (But also waku/events/* and waku/requests/* will be part of the API?)

fcecin and others added 8 commits February 3, 2026 16:09
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
* Use sync impl awareness for subscription proc sync results
* Delete subscription event source (for now)
* Remove checkApiAvailability
@fcecin fcecin changed the title Introduce the Waku API's subscribe function Introduce the Waku API's subscribe function (+ refactor waku_api.md) Feb 4, 2026
@fcecin fcecin marked this pull request as ready for review February 4, 2026 15:47
@fcecin fcecin merged commit ed7b40c into master Feb 9, 2026
1 check passed
@fcecin fcecin deleted the waku-api/subscribe branch February 9, 2026 14:33
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.

3 participants