Skip to main content
Module

x/cav/endpoints.ts>socket

A server framework for Deno
Go to Latest
function socket
import { socket } from "https://deno.land/x/cav@0.0.24/endpoints.ts";

Constructs a new Socket request handler using the provided schema and setup function. The schema properties will be assigned to the returned socket endpoint function, with the setup argument available as the "setup" property.

Type Parameters

Schema extends SocketSchema | null
optional
Setup extends ((x: SetupArg<Schema>) => any) = () => Omitted

Parameters

optional
schema: (Schema & SocketSchema) | null
optional
setup: Setup & ((x: SetupArg<Schema>) => Promise<void> | void)

Returns

Socket<[K in keyof Schema | "setup"in keyof (K extends "setup" ? (Setup extends () => Omitted ? never : K) : K)]: (K extends "setup" ? Setup : K extends keyof Schema ? Schema[K] : never)>

Type Parameters

optional
Setup extends (x: SetupArg<{ }>) => any = () => Omitted

Parameters

optional
setup: Setup

Returns

Socket<Setup extends () => Omitted ? { } : { setup: Setup; }>