Logo
Explore Help
Sign In
logos-messaging/logos-messaging-nim
1
0
Fork 0
You've already forked logos-messaging-nim
mirror of https://github.com/logos-messaging/logos-messaging-nim.git synced 2026-06-27 20:10:02 +00:00
Code Issues Packages Projects Releases Wiki Activity
logos-messaging-nim/library/messaging_api/subscriptions_api.nim

14 lines
441 B
Nim
Raw Permalink Normal View History

Migrate FFI to nim-ffi v0.2.0-rc.3 (typed procs, direct params) Rewrite the C FFI over the new per-layer APIs using nim-ffi v0.2.0 typed {.ffiCtor.}/{.ffiDtor.}/{.ffi.}/{.ffiEvent.} + CBOR, replacing the hand-written cstring/JSON bridge and the declare/lifecycle scaffolding. Final API shape from the start (no intermediate request wrappers): - every {.ffi.} proc takes its parameters directly; the macro bundles them into the per-proc CBOR request, so no `*Request` objects are needed - WakuMessage rides the wire directly (its fields are CBOR-serializable) - multi-parameter {.ffiEvent.} via the rc.3 envelope synthesis - events are fed by internal nim-broker listeners (no AppCallbacks) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 11:54:47 +02:00
proc subscribe*(
self: LogosDelivery, contentTopic: string
): Future[Result[string, string]] {.ffi.} =
(await self.messagingClient.subscribe(ContentTopic(contentTopic))).isOkOr:
return err(error)
return ok("")
proc unsubscribe*(
self: LogosDelivery, contentTopic: string
): Future[Result[string, string]] {.ffi.} =
self.messagingClient.unsubscribe(ContentTopic(contentTopic)).isOkOr:
return err(error)
return ok("")
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.0 Page: 196ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API