UNPKG

hono-rate-limiter

Version:
15 lines (14 loc) 692 B
import type { Context, Env, Input } from "hono"; import type { WSEvents } from "hono/ws"; import type { GeneralConfigType, WSConfigType } from "./types"; /** * * Create an instance of ws based rate-limiting middleware for Hono. * * @param config {WSConfigType} - Options to configure the rate limiter. * * @returns - The middleware that rate-limits clients based on your configuration. * * @public */ export declare function webSocketLimiter<E extends Env = Env, P extends string = string, I extends Input = Input>(config: GeneralConfigType<WSConfigType<E, P, I>>): (createEvents: (c: Context<E, P, I>) => WSEvents | Promise<WSEvents>) => (c: Context<E, P, I>) => Promise<WSEvents>;