You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,13 +44,13 @@ Start the server by providing a port number:
44
44
importFlyingFox
45
45
46
46
let server =HTTPServer(port: 80)
47
-
tryawait server.start()
47
+
tryawait server.run()
48
48
```
49
49
50
50
The server runs within the the current task. To stop the server, cancel the task terminating all connections immediatley:
51
51
52
52
```swift
53
-
let task =Task { tryawait server.start() }
53
+
let task =Task { tryawait server.run() }
54
54
task.cancel()
55
55
```
56
56
@@ -72,7 +72,7 @@ Retrieve the current listening address:
72
72
await server.listeningAddress
73
73
```
74
74
75
-
> Note: iOS will hangup the listening socket when an app is suspended in the background. Once the app returns to the foreground, `HTTPServer.start()` detects this, throwing `SocketError.disconnected`. The server must then be started once more.
75
+
> Note: iOS will hangup the listening socket when an app is suspended in the background. Once the app returns to the foreground, `HTTPServer.run()` detects this, throwing `SocketError.disconnected`. The server must then be started once more.
76
76
77
77
## Handlers
78
78
@@ -360,7 +360,7 @@ struct MyHandler {
360
360
}
361
361
362
362
let server =HTTPServer(port: 80, handler: MyHandler())
363
-
tryawait server.start()
363
+
tryawait server.run()
364
364
```
365
365
366
366
The annotations are implemented via [SE-0389 Attached Macros](https://github.com/apple/swift-evolution/blob/main/proposals/0389-attached-macros.md).
0 commit comments