Server Class — vite Architecture
Architecture documentation for the Server class in ws.d.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD ad90463c_a644_6de1_2cdc_a0a9c84fd7a1["Server"] f807a74d_76fa_6b24_918f_7ef78a219c18["ws.d.ts"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|defined in| f807a74d_76fa_6b24_918f_7ef78a219c18 dedbc1e5_cca7_87d2_63a6_106d800f4403["constructor()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| dedbc1e5_cca7_87d2_63a6_106d800f4403 f2ba4bd3_cc9e_e440_6832_18a596f436a5["address()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| f2ba4bd3_cc9e_e440_6832_18a596f436a5 8f1cb074_4b8d_7842_b36a_ef6916ccd511["close()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 8f1cb074_4b8d_7842_b36a_ef6916ccd511 10276aaf_bd13_1bd3_60ba_84a6523c9c14["handleUpgrade()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 10276aaf_bd13_1bd3_60ba_84a6523c9c14 5787ec74_b146_ed91_34f0_decb5a263cf2["shouldHandle()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 5787ec74_b146_ed91_34f0_decb5a263cf2 be8b37a6_963f_57e3_5232_f9d00a8f3f56["on()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| be8b37a6_963f_57e3_5232_f9d00a8f3f56 0d6c16ef_6015_d728_ece7_9dbe1b3f6034["once()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 0d6c16ef_6015_d728_ece7_9dbe1b3f6034 87487608_2b2f_9bfb_9448_bb463196d7bb["off()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 87487608_2b2f_9bfb_9448_bb463196d7bb 8ebc1706_6368_2103_f337_3d648eda270f["addListener()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 8ebc1706_6368_2103_f337_3d648eda270f 065b1cd5_f7eb_92ad_ef88_6159599f75cf["removeListener()"] ad90463c_a644_6de1_2cdc_a0a9c84fd7a1 -->|method| 065b1cd5_f7eb_92ad_ef88_6159599f75cf
Relationship Graph
Source Code
packages/vite/src/types/ws.d.ts lines 449–550
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
options: ServerOptions
path: string
clients: Set<T>
constructor(options?: ServerOptions, callback?: () => void)
address(): AddressInfo | string
close(cb?: (err?: Error) => void): void
handleUpgrade(
request: IncomingMessage,
socket: Duplex,
upgradeHead: Buffer,
callback: (client: T, request: IncomingMessage) => void,
): void
shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
// Events
on(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
): this
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
on(
event: 'headers',
cb: (
this: Server<T>,
headers: string[],
request: IncomingMessage,
) => void,
): this
on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
on(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void,
): this
once(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
): this
once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
once(
event: 'headers',
cb: (
this: Server<T>,
headers: string[],
request: IncomingMessage,
) => void,
): this
once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
once(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void,
): this
off(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
): this
off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
off(
event: 'headers',
cb: (
this: Server<T>,
headers: string[],
request: IncomingMessage,
) => void,
): this
off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
off(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void,
): this
addListener(
event: 'connection',
cb: (client: T, request: IncomingMessage) => void,
): this
addListener(event: 'error', cb: (err: Error) => void): this
addListener(
Defined In
Source
Frequently Asked Questions
What is the Server class?
Server is a class in the vite codebase, defined in packages/vite/src/types/ws.d.ts.
Where is Server defined?
Server is defined in packages/vite/src/types/ws.d.ts at line 449.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free