aboutsummaryrefslogtreecommitdiff
path: root/docs/api/tcp.md
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-04-13 18:26:45 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-13 18:26:45 -0700
commit011e157cac7698050370e24495a9002dacfceea9 (patch)
treeebb561dbda3e8f67302cc4d5b398f4a2744f7884 /docs/api/tcp.md
parent0cc56e8efce9c7d4905b3649827bf9b40a677b25 (diff)
downloadbun-011e157cac7698050370e24495a9002dacfceea9.tar.gz
bun-011e157cac7698050370e24495a9002dacfceea9.tar.zst
bun-011e157cac7698050370e24495a9002dacfceea9.zip
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
Diffstat (limited to 'docs/api/tcp.md')
-rw-r--r--docs/api/tcp.md6
1 files changed, 3 insertions, 3 deletions
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
}