///
import InternalRequestContext from "../../types/internal/classes/RequestContext";
import { Content } from "../../types/global";
import Base from "./Base";
import { WsContext } from "../../types/implementation/contexts/ws";
import Channel from "../Channel";
import Server from "../Server";
export default class WsOpenContext = {}> extends Base {
protected rawContext: WsContext;
protected abort: AbortSignal;
constructor(context: InternalRequestContext, server: Server, rawContext: WsContext, abort: AbortSignal, type?: Type);
/**
* The Type of this Websocket Event
* @since 5.7.0
*/ readonly type: Type;
/**
* Websocket Close (Abort) Controller (please use to decrease server load)
* @since 9.0.0
*/ $abort(callback?: () => void): boolean;
/**
* Close the Socket and send a Code + Message to the Client (automatically Formatted)
*
* This will instantly close the socket connection with a status code and
* message of choice, after calling and successfully closing the `.onClose()`
* callback will be called to finish the task.
* @example
* ```
* ctr.close(1011, 'An Error has occured')
* ```
* @since 5.4.0
*/ close(code?: number, reason?: string): this;
/**
* Print a Message to the Client (automatically Formatted)
*
* This Message will instantly sent to the client, since this
* is a websocket, this also means that the message cannot be
* overriden after this function is called.
* @example
* ```
* await ctr.print({
* message: 'this is json!'
* })
*
* // content will be `{"message":"this is json!"}`
*
* /// or
*
* await ctr.print({
* message: 'this is json!'
* }, true)
* // content will be `{\n "message": "this is json!"\n}`
*
* /// or
*
* await ctr.print('this is text!')
* // content will be `this is text!`
* ```
* @since 5.4.0
*/ print(type: 'text' | 'binary', content: Content, prettify?: boolean): Promise;
/**
* Print a Raw Message to the Client (ArrayBuffer only)
*
* Same as `.print()` but only accepts ArrayBuffer as the content and therefore
* skips the parsing process. This is useful for sending data synchronously.
* @example
* ```
* const buffer = new ArrayBuffer(10)
*
* ctr.printRaw('binary', buffer)
* ```
* @since 9.8.0
*/ printRaw(type: 'text' | 'binary', content: ArrayBuffer): this;
/**
* Print a channels value to the client
*
* This will print when the provided channel has a new value,
* basically subscribing to the channel.
* @example
* ```
* const channel = new Channel()
*
* ctr.printChannel(channel)
*
* ref.send('text', 'Ok')
* ```
* @since 9.0.0
*/ printChannel(channel: Channel): this;
/**
* Remove a channel from the client
*
* This will remove the subscription to the channel
* from the client. No more messages will be sent.
* @example
* ```
* const channel = new Channel()
*
* ctr.printChannel(channel)
*
* ref.send('Ok')
*
* ctr.removeChannel(channel)
*
* ref.send('No') // will not be sent
* ```
* @since 9.0.0
*/ removeChannel(channel: Channel): this;
/**
* Print a raw channels value to the client
*
* This will print when the provided channel has a new value,
* basically subscribing to the channel. This uses strings to
* identify the channel instead of the channel object. (CAUTION)
* @example
* ```
* ctr.printRawChannel('channel')
*
* await ctr.$channel('channel').print('text', 'Ok')
* ```
* @since 9.8.0
*/ printRawChannel(channel: string): this;
/**
* Remove a raw channel from the client
*
* This will remove the subscription to the channel
* from the client. No more messages will be sent. This
* uses strings to identify the channel instead of the
* channel object. (CAUTION)
* @example
* ```
* ctr.printRawChannel('channel')
*
* await ctr.$channel('channel').print('text', 'Ok')
*
* ctr.removeRawChannel('channel')
*
* await ctr.$channel('channel').print('text', 'No') // will not be sent
* ```
* @since 9.8.0
*/ removeRawChannel(channel: string): this;
}