Skip to content

feat(examples): in-library chronos CBOR IPC server + cross-platform CI#68

Draft
Ivansete-status wants to merge 1 commit into
masterfrom
ipc-chronos-server
Draft

feat(examples): in-library chronos CBOR IPC server + cross-platform CI#68
Ivansete-status wants to merge 1 commit into
masterfrom
ipc-chronos-server

Conversation

@Ivansete-status

@Ivansete-status Ivansete-status commented May 31, 2026

Copy link
Copy Markdown
Collaborator

What

A standalone IPC example: the library serving itself over a CBOR socket, plus the automated cross-platform validation it needs. Self-contained on master (no dependency on the native-ABI stack) in examples/timer/ipc_chronos/.

serve.nim compiles into libmy_timer only under -d:ffiIpcServe (every other build untouched) and runs a chronos socket server that, per request, decodes CBOR at the socket edge and calls the library's own async procs directly — native, in-process, zero serialization between the socket and the logic. No FFI boundary, no callback bridge: the server is the library. Exposed as my_timer_serve(address).

remote client ──CBOR over socket──▶ serve loop ──direct Nim call──▶ timer procs
              (inter-process)                   (in-process, zero-serialization)

Why CBOR at the wire (not the native struct ABI): a relay's data is serialized regardless, so native would only relocate the decode and add marshalling for no gain — native locally, CBOR for IPC.

Portable

serve_host.nim starts it; client.nim is a lib-free chronos client. Both use chronos sockets, so the example builds and runs on Linux, macOS and Windows over TCP (unix sockets are a POSIX bonus).

CI

tests/e2e/ipc/run_roundtrip.nim builds the dylib + host + client, spawns the server and round-trips over loopback TCP asserting the replies — wired as nimble test_ipc and a 3-OS CI matrix (ubuntu/macos/windows). Closes the gap where the IPC story had no automated validation.

Validated locally on macOS; the matrix exercises Linux/Windows.

🤖 Generated with Claude Code

Adds a standalone IPC example: the library serving itself over a CBOR socket.
examples/timer/ipc_chronos/serve.nim compiles into libmy_timer only under
-d:ffiIpcServe (every other build untouched) and runs a chronos socket server
that, per request, decodes CBOR at the socket edge and calls the library's own
async procs directly — native, in-process, zero serialization between the
socket and the logic, no FFI boundary, no callback bridge. Exposed as
my_timer_serve(address).

CBOR (not the native struct ABI) is correct at the wire here: a relay's data is
serialized regardless, so native would only relocate the decode and add
marshalling for no gain — native locally, CBOR for IPC.

serve_host.nim starts it; client.nim is a lib-free chronos client. Both use
chronos sockets, so the example builds and runs on Linux, macOS and Windows
over TCP (unix sockets are a POSIX bonus).

CI: tests/e2e/ipc/run_roundtrip.nim builds the dylib + host + client, spawns
the server and round-trips over loopback TCP asserting the replies; wired as
`nimble test_ipc` and a 3-OS CI matrix (ubuntu/macos/windows).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Ivansete-status
Ivansete-status changed the base branch from native-events to master June 1, 2026 06:43
@Ivansete-status Ivansete-status changed the title feat(examples): in-library chronos CBOR server + cross-platform IPC CI feat(examples): in-library chronos CBOR IPC server + cross-platform CI Jun 1, 2026
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.

1 participant