/// /// import InternalRequestContext from "../../types/internal/classes/RequestContext"; import { WsContext } from "../../types/implementation/contexts/ws"; import WsOpenContext from "./WsOpenContext"; import { JSONParsed, ParsedBody, RatelimitInfos } from "../../types/global"; import Server from "../Server"; export default class WsMessageContext = {}> extends WsOpenContext<'message', Context> { constructor(context: InternalRequestContext, server: Server, rawContext: WsContext, abort: AbortSignal); /** * The Request Message as a Blob-like Object * @example * ``` * const size = await ctr.$message().size() * * return ctr.print(`The size of the message is ${size} bytes`) * ``` * @since 9.7.0 */ $message(): { text(): string; json(): JSONParsed; arrayBuffer(): Buffer; blob(): Blob; size(): number; }; /** * The Websocket Message (JSON Automatically parsed if enabled) * @since 5.4.0 */ message(): ParsedBody; /** * The Websocket Message Type * @since 9.0.0 */ messageType(): 'text' | 'binary'; /** * The Raw Websocket Message * @since 5.5.2 */ rawMessage(encoding: BufferEncoding): string; /** * The Raw Socket Message as Buffer * @since 8.1.4 */ rawMessageBytes(): Buffer; /** * Skips counting the request to the Client IPs Rate limit (if there is one) * * When a specific IP makes sends a message to an endpoint under a ratelimit, the maxhits will be * increased instantly to prevent bypassing the rate limit by spamming messages faster than the host can * handle. When this function is called, the server removes the set hit again. * @since 8.6.0 */ skipRateLimit(): this; /** * Clear the active Ratelimit of the Client * * This Clears the currently active Ratelimit (on this socket) of the Client, remember: * you cant call this in a normal message callback if the max hits are already reached since well... * they are already reached. * @since 8.6.0 */ clearRateLimit(): this; /** * Get Infos about the current Ratelimit * * This will get all information about the currently applied ratelimit * to the socket. If none is active, will return `null`. */ getRateLimit(): RatelimitInfos | null; }