Skip to content

Conversation

@lthibault
Copy link
Contributor

Add support for invoking named WASM exports instead of hardcoded 'poll'.

Changes:

  • Update Proc.ProcessMessage to accept method parameter
  • Switch to SetStreamHandlerMatch for method-based routing
  • Add method as positional arg to ww cat command
  • Update echo example to export 'echo' function
  • Maintain backward compatibility

Usage:

ww cat peer /proc echo    # calls 'echo' export
ww cat peer /proc poll    # calls 'poll' export  

- Update ProcessMessage to accept method parameter for dynamic export invocation
- Add method normalization (empty string defaults to 'poll')
- Add proper error handling for unknown methods with stream reset
- Update all test calls to include method parameter
- Maintain backward compatibility with existing code
- Switch from SetStreamHandler to SetStreamHandlerMatch
- Add protocol matching for both base protocol and method suffix
- Extract method from protocol string (/ww/0.1.0/<proc-id>/<method>)
- Update logging to include method information
- Maintain backward compatibility for existing clients
- Change method from flag to positional argument (final argument)
- Update ArgsUsage to <peer> <proc> [method]
- Add argument validation for 2-3 arguments
- Update protocol construction to include method suffix when specified
- Enhance connection banner to show method being used
- Update examples in help text
- Change exported function from 'poll' to 'echo'
- Update function name and comments accordingly
- This demonstrates the named export functionality
- Rebuild main.wasm with updated echo export function
- Binary now exports 'echo' instead of 'poll' function
@lthibault lthibault requested a review from mikelsr September 25, 2025 20:53
@lthibault lthibault self-assigned this Sep 25, 2025
@lthibault lthibault added the enhancement New feature or request label Sep 25, 2025
- Update tests to use 'echo' function instead of 'poll' to match WASM module exports
- Add Reset() expectations to mock streams to handle function not found cases
- Fix TestProc_Integration_WithRealWasm, TestProc_Poll_WithGomock, TestEcho_Asynchronous, and TestEcho_RepeatedAsync
- All tests now pass successfully
@mikelsr mikelsr merged commit 2c2c0b0 into master Sep 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants