Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: examples/nodejs - adapt code to latest callback and ctx/userData definitions #2281

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

Ivansete-status
Copy link
Collaborator

@Ivansete-status Ivansete-status commented Dec 11, 2023

NodeJs example adaptation to the latest cbindings approach, where we use a Context and userData.

@Ivansete-status Ivansete-status marked this pull request as ready for review December 11, 2023 11:00
@Ivansete-status Ivansete-status self-assigned this Dec 11, 2023
Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

Seems all good!
Only remark that we discussed offline.
I see no exact reason for double dereference ctx on the subsequent api calls in C after creation.
I saw that libwaku.nim api procs are waiting for ptr ptr Context while libwaku.h just has the signature void* ctx. This might not be obvious for the lib user from C side to pass a void** ctx. Maybe there is room for future improvement here.
I would consider to use an artificial handle (unique id) as context descriptor not a raw pointer. Such a handle can be checked on the library side to avoid missuse of pointers.

@gabrielmer
Copy link
Contributor

I think that the number of arguments to call a function do not match with the definitions in https://github.com/waku-org/nwaku/blob/c9d558f878f89319ddf397304a475ddb480305cf/library/libwaku.nim for the functions waku_new and waku_set_event_callback

Otherwise LGTM :)

@Ivansete-status Ivansete-status merged commit d01904e into master Dec 18, 2023
8 checks passed
@Ivansete-status Ivansete-status deleted the fix-nodejs-example branch December 18, 2023 22:16
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