defineHooks function
Define a Hooks.
Implementation
Hooks defineHooks({
required FutureOr<void> Function(Peer peer, Message message) message,
FutureOr<void> Function(Peer peer)? open,
FutureOr<void> Function(Peer peer, [int? code, String? reason])? close,
FutureOr<void> Function(Peer peer, Object? error)? error,
FutureOr<Headers?> Function(Event event)? upgrade,
}) {
return _DefinedHooks(
onMessage: message,
onOpen: open,
onClose: close,
onError: error,
onUpgrade: upgrade,
);
}