diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-12-17 20:46:15 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-12-17 20:46:15 +0100 |
| commit | 4134750ef6921c8f0fcac898594101a6ca5f4f4f (patch) | |
| tree | 88928056cd4bfe14d3d78f82256fd78cf5672620 /types/web-socket-stream/index.d.ts | |
Initial commit
Diffstat (limited to 'types/web-socket-stream/index.d.ts')
| -rw-r--r-- | types/web-socket-stream/index.d.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/types/web-socket-stream/index.d.ts b/types/web-socket-stream/index.d.ts new file mode 100644 index 0000000..ebecb22 --- /dev/null +++ b/types/web-socket-stream/index.d.ts @@ -0,0 +1,24 @@ +declare interface WebSocketOpenInfo { + readable: ReadableStream + writable: WritableStream + extensions: string + protocol: string +} + +declare interface WebSocketCloseInfo { + closeCode: number + reason: string +} + +declare interface WebSocketStreamOptions { + protocols?: string[] + signal?: AbortSignal +} + +declare class WebSocketStream { + constructor(url: string, options?: WebSocketStreamOptions) + readonly url: string + readonly opened: Promise<WebSocketOpenInfo> + readonly closed: Promise<WebSocketCloseInfo> + close(closeInfo?: WebSocketCloseInfo): any +}
\ No newline at end of file |
