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: crates/cli/src/subcommands/dev.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ pub fn cli() -> Command {
81
81
Arg::new("client-lang")
82
82
.long("client-lang")
83
83
.value_parser(clap::value_parser!(Language))
84
-
.help("The programming language for the generated client module bindings (e.g., typescript, csharp, python). If not specified, it will be detected from the project."),
84
+
.help("The programming language for the generated client module bindings (e.g., typescript, csharp, rust, unrealcpp). If not specified, it will be detected from the project."),
85
85
)
86
86
.arg(common_args::server().help("The nickname, host name or URL of the server to publish to"))
Copy file name to clipboardExpand all lines: docs/docs/00100-intro/00100-getting-started/00250-zen-of-spacetimedb.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ Perfect consistency, always.
80
80
81
81
## Everything is Programmable
82
82
83
-
SpacetimeDB doesn't limit you to declarative rules or configuration files. Your module is real code (Rust, C#, or TypeScript) running inside the database. You have the full power of a procedural, normal programming language at your disposal.
83
+
SpacetimeDB doesn't limit you to declarative rules or configuration files. Your module is real code (Rust, C#, TypeScript, or C++) running inside the database. You have the full power of a procedural, normal programming language at your disposal.
84
84
85
85
Need custom authorization logic? Write a function. Need to validate complex business rules? Write a function. Need to transform data before storing it? Write a function.
Copy file name to clipboardExpand all lines: docs/docs/00100-intro/00100-getting-started/00300-language-support.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,12 @@ slug: /intro/language-support
6
6
7
7
## Server Database Modules
8
8
9
-
SpacetimeDB modules define your database schema and server-side business logic. Modules can be written in three languages:
9
+
SpacetimeDB modules define your database schema and server-side business logic. Modules can be written in four languages:
10
10
11
11
-**[Rust](../../00200-core-concepts/00100-databases.md)** - High performance, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00500-rust.md)
12
12
-**[C#](../../00200-core-concepts/00100-databases.md)** - Great for Unity developers, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00600-c-sharp.md)
13
13
-**[TypeScript](../../00200-core-concepts/00100-databases.md)** - Ideal for web developers, runs on V8 [(Quickstart)](../00200-quickstarts/00400-typescript.md)
14
+
-**[C++](../../00200-core-concepts/00100-databases.md)** - Fits Unreal and C++ workflows, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00700-cpp.md)
Copy file name to clipboardExpand all lines: docs/docs/00100-intro/00100-getting-started/00500-faq.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ SpacetimeDB replaces the entire server. Your game state lives in tables, your ga
60
60
61
61
Firebase and Supabase are Backend-as-a-Service platforms. They give you a database with an API layer on top, but your application logic still runs elsewhere (cloud functions, edge functions, or your own server). Complex business logic is awkward to express as database triggers or serverless functions.
62
62
63
-
SpacetimeDB lets you write your entire application as a module in a real programming language (Rust, C#, TypeScript) that runs inside the database. You get full transactional guarantees, direct table access, and real-time subscriptions without the cold starts, execution limits, or awkward abstractions of serverless functions.
63
+
SpacetimeDB lets you write your entire application as a module in a real programming language (Rust, C#, TypeScript, or C++) that runs inside the database. You get full transactional guarantees, direct table access, and real-time subscriptions without the cold starts, execution limits, or awkward abstractions of serverless functions.
64
64
65
65
### How is SpacetimeDB different from a regular database (PostgreSQL, MySQL)?
66
66
@@ -149,7 +149,7 @@ SpacetimeDB 2.0 also includes a **type-safe query builder** for client-side subs
149
149
150
150
1. Install the CLI: `curl -sSf https://install.spacetimedb.com | sh`
// Only the WebGL player has the browser WebSocket header limitation.
747
+
// The Unity Editor uses the normal desktop transport even when the
748
+
// selected build target is WebGL, so keep the normal behavior there.
749
+
#ifUNITY_WEBGL&&!UNITY_EDITOR
750
+
if (AuthToken.Token=="")
751
+
{
752
+
// No token was supplied to the connection, so this is the
753
+
// long-lived server-issued token for the new identity. Save it.
754
+
// If a token already exists, this connect may have used a
755
+
// short-lived WebSocket token, which should not overwrite it.
756
+
AuthToken.SaveToken(token);
757
+
}
758
+
#else
746
759
AuthToken.SaveToken(token);
760
+
#endif
747
761
LocalIdentity=identity;
748
762
749
763
OnConnected?.Invoke();
@@ -787,6 +801,8 @@ public class GameManager : MonoBehaviour
787
801
}
788
802
```
789
803
804
+
> Unity WebGL needs one extra precaution here. Browser WebSocket APIs cannot set an `Authorization` header, so reconnecting with a saved server-issued token may yield a short-lived WebSocket token in `HandleConnect`. The `#if UNITY_WEBGL` guard keeps the original saved token instead of overwriting it during reconnect.
805
+
790
806
Here we configure the connection to the database, by passing it some callbacks in addition to providing the `SERVER_URI` and `MODULE_NAME` to the connection. When the client connects, the SpacetimeDB SDK will call the `HandleConnect` method, allowing us to start up the game.
791
807
792
808
In our `HandleConnect` callback we build a subscription and call `Subscribe`, subscribing to all data in the database. This causes SpacetimeDB to synchronize the state of all your tables with your Unity client's SDK client cache.
Keep the same WebGL guard from Part 2 here as well. On Unity WebGL, a reconnect can surface a short-lived WebSocket token in `HandleConnect`, so you should not overwrite an already-saved long-lived server-issued token.
1388
+
1373
1389
Next add the following implementations for those callbacks to the `GameManager` class.
0 commit comments