Add support for browser platform#274
Closed
CloneDeath wants to merge 188 commits into
Closed
Conversation
…i-updates Some API updates
…i-updates2 More API updates
…w updates and reducer events
…Improvements API callback improvements
…ption Add sslEnabled option to Connect function
* Fix compilation issue with master * Initial push for SATS (still WIP) * Small build fix * Small update * Updates from meeting with Tyler * Fixed issues with LayoutExplicit and added some missing functions * AlgebraicValue cleanup * Copied changes from BitCraftMini * Removed TypeDef --------- Co-authored-by: Clockwork Labs <no-reply@clockworklabs.io> Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com> Co-authored-by: John Detter <no-reply@boppygames.gg>
* Upload script to help deploying to our partners * You have to specify hosts individually * Small fix * Another small fix - tested + working --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
* Serialize byte arrays as hex * Fix namespace * Small fix --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
* First pass * Committing meta file * Removed option type - unneeded * Implementing new some converter * Some converter updates * Tons of fixes here * Cleaned up the some/enum serialization implementation --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
Co-authored-by: John <no-reply@boppygames.gg>
Co-authored-by: John Detter <no-reply@boppygames.gg>
…ckworklabs#15) Co-authored-by: John Detter <no-reply@boppygames.gg>
* Several updates to the way ClientCache + processing updates works * Client cache changes working * Removed log statements --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
* Copied changes from BitCraft * Applied state diff changes * State diffs complete * Compilation fix * Fix build issues --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
* Pulled SpacetimeUnitySDK from the BitCraft project * Removed unused logs * Removed primary key functionality * Fix compilation issues with older version of C# * Primary key client implementation * Another row update fix --------- Co-authored-by: John <no-reply@boppygames.gg>
* Pulled SpacetimeUnitySDK from the BitCraft project * Removed unused logs * Removed primary key functionality * Fix compilation issues with older version of C# --------- Co-authored-by: John <no-reply@boppygames.gg>
* Adding event parameter to table callbacks * Reverted a namespace change --------- Co-authored-by: Steve <steve@codefics.com> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Derek Brinkmann <dbrinkmann@citadelstudios.net>
* Add onSubscriptionUpdate callback * Remove unnecesary onTransactionComplete --------- Co-authored-by: Derek Brinkmann <dbrinkmann@citadelstudios.net>
…ed from callbacks (clockworklabs#20) Co-authored-by: Steve <steve@codefics.com>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Removed redundant onSubscriptionUpdate --------- Co-authored-by: Steve <steve@codefics.com> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com> Co-authored-by: John Detter <no-reply@boppygames.gg>
Co-authored-by: Steve <steve@codefics.com>
Co-authored-by: John Detter <no-reply@boppygames.gg>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Adding OnBeforeDelete event to tables * Renaming ReducerCallInfo to ReducerEvent * Removed extra onSubscriptionUpdate --------- Co-authored-by: Steve <steve@codefics.com> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Adding OnBeforeDelete event to tables --------- Co-authored-by: Steve <steve@codefics.com> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
…clockworklabs#244) ## Description of Changes as described ## API no breaks ## Requires SpacetimeDB PRs clockworklabs/SpacetimeDB#2241 ## Testsuite SpacetimeDB branch name: jgilles/unknown_reducer ## Testing see SpacetimeDB PR
## Description of Changes Companion PR for the http api glowup. ## API Not a breaking change; this catches us up to being compatible with a breakage introduced by - clockworklabs/SpacetimeDB#2225. ## Requires SpacetimeDB PRs - clockworklabs/SpacetimeDB#2225 ## Testsuite SpacetimeDB branch name: master ## Testing Existing CI passes (it was failing without this change since it couldn't connect). Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes We were not stripping `/` from the end of URIs provided to `Connect`. We manually append `/...` to the provided addresses, so if we don't start by stripping trailing `/`s, we end up with `//` in the URI and we get errors. Addresses part of clockworklabs/SpacetimeDB#1551. ## API No breaking changes. This fixes an error case. ## Requires SpacetimeDB PRs None ## Testsuite SpacetimeDB branch name: master ## Testing - [x] Tested the quickstart chat client with a host containing a trailing `/` ``` # start a server, publish the module, send some input # I also updated one line in `client.csproj` to use `Net8.0` because I no longer have `Net7.0` installed $ cd examples~/quickstart/client $ dotnet run [I] SpacetimeDBClient: Connecting to ws://localhost:3000 quickstart-chat C200098E is online Connected C2007471: hello C2007471: godo C2007471: asdf $ sed -i 's/localhost:3000/localhost:3000\//' Program.cs $ dotnet run [I] SpacetimeDBClient: Connecting to ws://localhost:3000 quickstart-chat C2000601 is online Connected C2007471: hello C2007471: godo C2007471: asdf $ git diff diff --git a/examples~/quickstart/client/Program.cs b/examples~/quickstart/client/Program.cs index 9eb43b1..289e736 100644 --- a/examples~/quickstart/client/Program.cs +++ b/examples~/quickstart/client/Program.cs @@ -7,8 +7,8 @@ using System.Threading; using SpacetimeDB; using SpacetimeDB.Types; -const string HOST = "http://localhost:3000"; -const string DBNAME = "chatqs"; +const string HOST = "http://localhost:3000/"; +const string DBNAME = "quickstart-chat"; // our local client SpacetimeDB identity Identity? local_identity = null; diff --git a/examples~/quickstart/client/client.csproj b/examples~/quickstart/client/client.csproj index 48917cc..ab7ce44 100644 --- a/examples~/quickstart/client/client.csproj +++ b/examples~/quickstart/client/client.csproj @@ -2,7 +2,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net7.0</TargetFramework> + <TargetFramework>net8.0</TargetFramework> <CheckEolTargetFramework>false</CheckEolTargetFramework> <ImplicitUsings>disable</ImplicitUsings> <Nullable>enable</Nullable> ``` --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes Switches to Bearer authentication, which is the more proper auth schema to use with tokens. ## API - [ ] This is an API breaking change to the SDK ## Requires SpacetimeDB PRs - clockworklabs/SpacetimeDB#2181 ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: master --------- Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com> Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io> Co-authored-by: James Gilles <jameshgilles@gmail.com>
## Description of Changes This updates the CI check protecting the release branch, as part of clockworklabs#226 (see that ticket for more details). Once this is merged, it will need to be cherrypicked into our release branch in order to take effect there. The check itself has also been renamed. I have already updated the branch protection rules to look for the new name. ## API No code changes. ## Requires SpacetimeDB PRs None ## Testsuite SpacetimeDB branch name: master ## Testing The previous behavior was well-tested, and I've just changed some strings here, so I have not done further testing. It does pass on this branch though. Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes Add SubscribeMulti and UnsubscribeMulti from upstream. Fix unsubscribe bug found by testing against Bitcraft: Calling `UnsubscribeThen` with any (non-null) callback would result in an exception incorrectly telling the user that `Unsubscribe` had been called twice. Multiplicity support is implemented with unit tests + manual testing of quickstart-chat. Also, rows in the client cache are now looked up by primary key if available, which I suspect is going to be a large performance boost. ## API - [x] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: jgilles/final-cs-codegen-changes ## Testing *Write instructions for a test that you performed for this PR* - [x] unit tests - [ ] Working with Ryan to add a test suite. - [x] blackholio
## Description of Changes Updates comment on `SubscribeToAllTables` since undefined behavior is not possible anymore. No code changes made in this patch. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs N/A ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: master ## Testing No code changes made in this patch.
## Description of Changes Adds closing `</summary>` to end of comment. ## API No breaking changes ## Requires SpacetimeDB PRs N/A ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: master ## Testing Just fixing a comment. No tests required.
…ument. (clockworklabs#258) # Description of Changes Update the C# server and client SDK quickstart-chat example to match the code presented in the tutorial, as of clockworklabs/spacetime-docs#170 . Also renamed the directory from `quickstart` to `quickstart-chat` in order to be more specific. # API and ABI breaking changes If this is an API or ABI breaking change, please apply the corresponding GitHub label. # Expected complexity level and risk 1 ## Requires SpacetimeDB PRs SpacetimeDB branch name: master com.clockworklabs.spacetimedbsdk: master # Testing *Describe any testing you've done, and any testing you'd like your reviewers to do, so that you're confident that all the changes work as expected!* - [x] Ran `quickstart-chat` C# server and C# client locally and: - Set my name. - Sent a message. - Restarted and viewed the message backlog. - Sent a few more messages. - Exited, deleted my local token, restarted and connected as a new identity. - Set my new identity's name. - Sent a message as my new identity. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com> Co-authored-by: John Detter <no-reply@boppygames.gg> Co-authored-by: james gilles <jameshgilles@gmail.com>
## Description of Changes Just link to the existing docs. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs ## Testsuite SpacetimeDB branch name: master ## Testing
## Description of Changes This just bumps our package versions to be 1.0.0. ## API No breaking changes ## Requires SpacetimeDB PRs clockworklabs/SpacetimeDB#2283 ## Testsuite SpacetimeDB branch name: bfops/bump-version ## Testing Existing CI only. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com> Co-authored-by: John Detter <no-reply@boppygames.gg> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
…abs#270) ## Description of Changes Relaxed this version number from `1.0.0` to `1.0.*` ## API No breaking changes. ## Requires SpacetimeDB PRs None ## Testsuite SpacetimeDB branch name: master ## Testing Existing CI should run `dotnet test` and confirm that this is not broken. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes *Describe what has been changed, any new features or bug fixes* I've already pushed this out to nuget here: <https://www.nuget.org/packages/SpacetimeDB.ClientSDK> - We want to update our REAME on nuget.org because the README that we released as part of 1.0.1 was very much out of date. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* NA ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: master ## Testing *Write instructions for a test that you performed for this PR* - [x] The README is updated. Co-authored-by: John Detter <no-reply@boppygames.gg>
Adds an additional test of the `GenericEqualityComparer` function for `Integer`, `String`, `Byte Array`, `Identity`, `User` and `TaggedEnum` type comparisons. This PR resolves additional checks as reported in by [Issue 230](clockworklabs#230) that where not-yet covered elsewhere. ## API - [ ] This is an API breaking change to the SDK ## Requires SpacetimeDB PRs No other PR are needed for this to work. ## Testsuite SpacetimeDB branch name: master ## Testing - [X] Locally ran `dotnet test` against the `tests.csproj` project and it passed all tests
…abs#268) ## Description of Changes Updated two README docs: * README.md - Updated links to point to Blackholio repo and tutorial docs. * README.dotnet.md - Updated to point to new URL paths for C# SDK Quickstart and Reference docs. ## API - [ ] This is an API breaking change to the SDK ## Requires SpacetimeDB PRs N/A - Docs only change ## Testsuite N/A - Docs only change SpacetimeDB branch name: master ## Testing - [X] Clicked on each new link and confirm the browser can locate the new locations. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com> Co-authored-by: John Detter <no-reply@boppygames.gg>
## Description of Changes I don't know if the DLLs need updating, but updated the DLLs just in case. ## API Incorporate any chances in SpacetimeDB 1.0.1. There should be no breaking changes. ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* ## Testsuite SpacetimeDB branch name: release/v1.0.1 ## Testing None. Will test in release. --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Updates package version to 1.0.1 ## API - [ ] This is an API breaking change to the SDK ## Requires SpacetimeDB PRs No specific PR needed ## Testsuite SpacetimeDB branch name: release/v1.0.1 ## Testing - [X] Confirmed Unity sees version as 1.0.1 after change
…r compatible Channels
Author
z0isch
reviewed
Mar 24, 2025
| @@ -66,10 +65,6 @@ public async Task Connect(string? auth, string host, string nameOrAddress, Conne | |||
| { | |||
| Ws.Options.SetRequestHeader("Authorization", $"Bearer {auth}"); | |||
There was a problem hiding this comment.
I ran into issues here as well, I don't think browser supports SetRequestHeader.
You can use a param in the querystring instead though like
if (auth != null)
{
uri += $"&token={Uri.EscapeDataString(auth)}";
}
Collaborator
|
Thanks for opening this! We'll work on getting it reviewed. |
This was referenced Jul 21, 2025
Collaborator
|
I think this is superseded by clockworklabs/SpacetimeDB#2975. We're currently in the process of merging this repo into SpacetimeDB, so if clockworklabs/SpacetimeDB#2975 is insufficient, please open any remaining changes against SpacetimeDB/sdks/csharp. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Added support for the
browserplatform.This required:
Thread.Startwith aTask(Thread.Startis not supported forbrowserplatforms)PreProcessMessagesasync, in order to useChannels async methodsTaskto be allowed to run on a separate thread (ConfigureAwait(false))BlockingCollection(which is not supported on thebrowserplatform) withChannel(which is supported on all platforms)IDbConnection.Connectto run on any thread, not necessarily the caller (ConfigureAwait(false))Ws.Options.UseDefaultCredentials = true;(this is alreadytrueby default. In addition, using this setter is not being supported bybrowserplatforms.)Unrelated:
IsConnectedbefore closing a connection, to avoid an exception being thrown about the connection not being open (as it's already closed).Remaining Issues:
browserplatform (likely either to a task misconfiguration, or it could be an issue in my Blazor chat implementation). Regardless, subscriptions still work fine on the CLI implementation, so this is not a regression.API
N/A. No changes to the API.
Requires SpacetimeDB PRs
N/A
Testsuite
SpacetimeDB branch name: master
Testing
Testing was performed manually inside of a Blazor "quickstart-chat" client, code can be found here: https://github.com/CloneDeath/SpacetimeWebChat/tree/stdb-browser-support