Mshutdown
Bun

method

Socket.shutdown

halfClose?: boolean
): void;

Shuts down the write-half or both halves of the connection. This allows the socket to enter a half-closed state where it can still receive data but can no longer send data (halfClose = true), or close both read and write (halfClose = false, similar to end() but potentially more immediate depending on OS). Calls shutdown(2) syscall internally.

@param halfClose

If true, only shuts down the write side (allows receiving). If false or omitted, shuts down both read and write. Defaults to false.

// Stop sending data, but allow receiving
socket.shutdown(true);

// Shutdown both reading and writing
socket.shutdown();