Skip to content

Commit

Permalink
fix remaining errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tayloraswift committed Jan 9, 2025
1 parent d4dfd41 commit b9a5bff
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
15 changes: 12 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "e67e7a21b222173d4b8958ed36f7e72d20ff9897c188997a55dc05412f8b0860",
"originHash" : "bc7e7da478a806e0f7cbe377f7686d6279b8f12a875ce24603298eac157fefe8",
"pins" : [
{
"identity" : "async-http-client",
Expand Down Expand Up @@ -96,8 +96,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/orlandos-nl/MongoKitten.git",
"state" : {
"revision" : "6654e801833d5dab3c04af065646ba727f9542e9",
"version" : "7.9.7"
"revision" : "d9a82f57e24018cfa47a4aa359b51e684040871a",
"version" : "7.9.8"
}
},
{
Expand Down Expand Up @@ -190,6 +190,15 @@
"version" : "1.3.1"
}
},
{
"identity" : "swift-jobs",
"kind" : "remoteSourceControl",
"location" : "https://github.com/hummingbird-project/swift-jobs.git",
"state" : {
"revision" : "6aeb0a179567b944ecf81e1bbfdd474c1ee171f1",
"version" : "1.0.0-beta.6"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
Expand Down
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let package = Package(
.package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.2"),
.package(url: "https://github.com/hummingbird-project/hummingbird-websocket.git", from: "2.0.0"),
.package(url: "https://github.com/hummingbird-project/swift-mustache.git", from: "2.0.0-beta.3"),
.package(url: "https://github.com/hummingbird-project/swift-jobs.git", from: "1.0.0-beta.6"),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.21.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
Expand All @@ -33,6 +34,7 @@ let package = Package(
.product(name: "HummingbirdRouter", package: "hummingbird"),
.product(name: "AsyncHTTPClient", package: "async-http-client"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "Jobs", package: "swift-jobs"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "Logging", package: "swift-log"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Let's create our first connection:

For our social network, we'll create a Post model using the ``Codable`` protocol:

@Snippet(path: "site/Snippets/mongokitten-models", slice: "models")
@Snippet(path: "site/Snippets/mongokitten-basics", slice: "models")

The ``ObjectId`` type is MongoDB's native unique identifier, similar to a ``UUID``. Every document in MongoDB has an `_id` field, which must be unique within a collection.
The ``ObjectId`` type is MongoDB's native unique identifier, similar to a ``UUID``. Every document in MongoDB has an `_id` field, which must be unique within a collection.

### Creating Posts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Make sure you have MongoDB running locally before starting.

## The Connection Manager

The ``ConnectionManager`` handles WebSocket connections and MongoDB change notifications:
The `ConnectionManager` handles WebSocket connections and MongoDB change notifications:

@Snippet(path: "site/Snippets/realtime-mongodb-app", slice: "connection-manager")

Expand All @@ -36,7 +36,7 @@ The use of `withRegisteredClient` ensures that the WebSocket connection is prope
### Watching for Changes

Now that the ``ConnectionManager`` is implemented, we can watch for changes in the MongoDB database. For this, we'll tie the ``ConnectionManager`` to the application lifecycle using the ``Service`` protocol.
Now that the `ConnectionManager` is implemented, we can watch for changes in the MongoDB database. For this, we'll tie the `ConnectionManager` to the application lifecycle using the ``Service`` protocol.

@Snippet(path: "site/Snippets/realtime-mongodb-app", slice: "watch-changes")

Expand Down Expand Up @@ -112,10 +112,10 @@ You've learned how to create a real-time feed of MongoDB changes using ChangeStr

@Comment {
Primary Keyword: mongodb changestream swift
Secondary Keywords:
Secondary Keywords:
- swift websocket mongodb
- real-time mongodb updates
- mongodb swift streaming
- swift websocket server
- mongodb changestream tutorial
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The [HummingbirdCore](https://github.com/hummingbird-project/hummingbird-core) r

## Jobs framework updates

The HummingbirdJobs framework can be used to push work onto a queue, so that is processed outside of a request. Job handlers were restructured to use ``TaskGroup`` and conform to the ``Service`` protocol from the Swift service lifecycle framework. A ``JobQueue`` can also define it's own ``JobID`` type, which helps when integrating with various database/driver implementations.
The HummingbirdJobs framework can be used to push work onto a queue, so that is processed outside of a request. Job handlers were restructured to use ``TaskGroup`` and conform to the ``Service`` protocol from the Swift service lifecycle framework. A ``JobQueue`` can also define it's own ``JobQueueDriver/JobID`` type, which helps when integrating with various database/driver implementations.

## Connection pools

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In order to start accepting packets, bind a UDP socket to a port:
1. First, create a ``DatagramBootstrap`` to open a UDP socket.
2. Next, bind the socket to a port using the `bind` method.
3. Before completing the setup, transform the created ``Channel`` by wrapping it in a ``NIOAsyncChannel``
4. Unlike TCP, a UDP server does not receive _connections_. It receives an ``AddressedEnvelope`` containing a ``ByteBuffer`` and the sender's ``SocketAddress``.
4. Unlike TCP, a UDP server does not receive _connections_. It receives an ``AddressedEnvelope`` containing a ``ByteBuffer`` and the sender's ``NIOCore/SocketAddress``.

Now that you've bound the socket, you can start receiving packets.

Expand Down

0 comments on commit b9a5bff

Please sign in to comment.