mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
rename and fix tcp example
This commit is contained in:
parent
ac293fb733
commit
62ab08ac93
@ -1,6 +1,6 @@
|
||||
# tcp
|
||||
# sockets
|
||||
|
||||
- makes a connection to tcpbin.com:4242
|
||||
- makes a TCP connection to tcpbin.com:4242.
|
||||
|
||||
## Development
|
||||
|
@ -11,12 +11,7 @@ import (
|
||||
|
||||
func main() {
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
dialer, err := sockets.NewDialer(req.Context(), nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
conn, err := dialer.Dial(req.Context(), "tcp", "tcpbin.com:4242")
|
||||
conn, err := sockets.Connect(req.Context(), "tcpbin.com:4242", nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
@ -1,6 +1,6 @@
|
||||
name = "tcp"
|
||||
name = "sockets"
|
||||
main = "./build/worker.mjs"
|
||||
compatibility_date = "2023-02-24"
|
||||
compatibility_date = "2024-01-03"
|
||||
|
||||
[build]
|
||||
command = "make build"
|
Loading…
x
Reference in New Issue
Block a user