aboutsummaryrefslogtreecommitdiff
path: root/docs/api/tcp.md
diff options
context:
space:
mode:
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
}