WebsockexNova.HandlerInvoker (WebsockexNova v0.1.0)

View Source

Centralized dispatcher for handler module invocation.

This module provides a single entry point for invoking any handler function (connection, message, subscription, auth, error, etc.) in a uniform way. It enables modular, testable, and DRY handler invocation logic.

Summary

Functions

Invokes the given function on the specified handler module with the provided args.

Functions

invoke(handler_type, fun, args, handlers)

@spec invoke(atom(), atom(), list(), map()) :: term()

Invokes the given function on the specified handler module with the provided args.

Parameters

  • handler_type: atom identifying the handler (e.g., :connection_handler)
  • fun: atom function name to call (e.g., :handle_connect)
  • args: list of arguments to pass to the function
  • handlers: map of handler_type => module

Returns

  • The result of the handler function, or :no_handler if handler is missing, or :no_function if the function is not exported by the handler module.