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
@@ -534,7 +542,7 @@ We are also using `localStorage` to store our SpacetimeDB credentials. This way,
534
542
535
543
If you chose a different name for your database, replace `quickstart-chat` with that name, or republish your module as `quickstart-chat`.
536
544
537
-
In the `onConnect` function we are also subscribing to the `message` and `user` tables. When we subscribe, SpacetimeDB will run our subscription queries and store the result in a local "client cache". This cache will be updated in real-time as the data in the table changes on the server.
545
+
Our React hooks will subscribe to the data in SpacetimeDB. When we subscribe, SpacetimeDB will run our subscription queries and store the result in a local "client cache". This cache will be updated in real-time as the data in the table changes on the server.
538
546
539
547
We pass our connection configuration directly to the `SpacetimeDBProvider` which will manage our connection to SpacetimeDB.
540
548
@@ -628,7 +636,7 @@ Modify the `onSubmitNewName` callback by adding a call to the `setName` reducer:
628
636
Next modify the `onSubmitMessage` callback by adding a call to the `sendMessage` reducer:
@@ -703,6 +711,33 @@ These callbacks will be called any time the state of the `useTable` result chang
703
711
704
712
Here we post a system message saying a new user has connected if the user is being added to the `user` table and they're online, or if an existing user's online status is being set to "online".
705
713
714
+
Next, let's add the system messages to our list of `Message`s so they can be interleaved with the chat messages. Modify `prettyMessages` to concat the `systemMessages` as well:
Congratulations!You've built a simple chat app with SpacetimeDB. You can find the full source code for the client we'vecreatedinthisquickstarttutorial [here](https://github.com/clockworklabs/SpacetimeDB/tree/master/sdks/typescript/examples/quickstart-chat).
0 commit comments