Skip to main content

Function: OnClient()

OnClient<E>(eventName?): MethodDecorator

Binds a server controller method to a client-originating event.

When applied, the decorated method will be invoked whenever the specified event is emitted from the client side.

Type Parameters

E

E extends string

Literal type of the event name.

Parameters

eventName?

E

Optional custom event name; if omitted, the method name is used.

Returns

MethodDecorator

A method decorator that registers the handler under EventType.ON_CLIENT.