# _Io_RegisterMiddleware

Middlewares are ran before the event is fired which makes it a great tool for validation, data manipulation and debugging.

_Io_RegisterMiddleware($sEventName, $fCallback)

## Return Value

True if middleware registrered with success.

## Remarks

Set $sEventName to * to trigger the middleware on every event. The $fCallback must be a valid function and the function MUST have these params (const $socket, ByRef $params, const $sEventName, ByRef $fCallbackName) and return true or false. False prevents the event from being fired.

## Related

_Io_unRegisterMiddleware, _Io_unRegisterEveryMiddleware