From 011e157cac7698050370e24495a9002dacfceea9 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Thu, 13 Apr 2023 18:26:45 -0700 Subject: Docs restructuring (#2638) * Restructure * Update nav * Reorg * Reshuffle ecosystem pages * Split up runtime/runtime * Back to runtime/index * Fix issue * Split up runtime/index * Add Writing Tests page * Prettier matcher table * More updates --- docs/api/tcp.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/api/tcp.md') diff --git a/docs/api/tcp.md b/docs/api/tcp.md index 5e04dd348..999464f3f 100644 --- a/docs/api/tcp.md +++ b/docs/api/tcp.md @@ -1,6 +1,6 @@ Use Bun's native TCP API implement performance sensitive systems like database clients, game servers, or anything that needs to communicate over TCP (instead of HTTP). This is a low-level API intended for library authors and for advanced use cases. -## Start a server +## Start a server (`Bun.listen()`) To start a TCP server with `Bun.listen`: @@ -90,7 +90,7 @@ server.stop(true); server.unref(); ``` -## Create a connection +## Create a connection (`Bun.connect()`) Use `Bun.connect` to connect to a TCP server. Specify the server to connect to with `hostname` and `port`. TCP clients can define the same set of handlers as `Bun.listen`, plus a couple client-specific handlers. @@ -136,7 +136,7 @@ const server = Bun.listen({ /* config */ }) // reloads handlers for all active server-side sockets server.reload({ - socket: + socket: { data(){ // new 'data' handler } -- cgit v1.2.3