Skip to content

Add "receiveWSMessage" and "sendWSMessage" to EventType type definition #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 62 commits into from

Conversation

mjoblin
Copy link

@mjoblin mjoblin commented Mar 12, 2024

See clockworklabs/SpacetimeDB#3038

Description of Changes

Added "receiveWSMessage" and "sendWSMessage" to the EventType type definition.

This PR assumes that these two event types (which are already being emitted) are intended to be part of the public API. My current use case is to capture the size of the incoming and outgoing WebSocket message data to track the transfer rate up/down.

(This is a code-only change. Tests still pass, and I didn't see any existing tests for this level of event emitting so I didn't add any. Please let me know if I missed something there!)

API

N/A.

Requires SpacetimeDB PRs

N/A.

NateTheDev1 and others added 30 commits March 29, 2023 16:04
It allows to subscribe to queries, like:

    client.subscribe("SELECT * FROM Player");
* Add some client tests

This adds tests for the client and the ability to supply a test adapter.
I also tried to mock WS, but for some reason it didn't work and I
figured out making our own adapter is simple enough.
* Remove package-log.json

We already have yarn lock, so no need to have both

* Add Prettier

* Format code using prettier

* Add husky and pretty-quick

This will ensure formatting before committing
Remove identity from credentials (not needed to log in)

Co-authored-by: Derek Brinkmann <[email protected]>
We support primaryKey fields now, thus we can also perform an update
operation on the client by utilizing the primaryKey
mamcx and others added 27 commits August 3, 2023 17:18
* Adding more doc comments with examples

* Copy docs from spacetimedb for the SATS types.

* Clarification for docs of subscription update

* Fix nits

* Minimal doc for Identity

* Fix params & undefined check in doc

* Copy the doc changes from the website
…uffer, this causes a bug in C# module implementation which actually validates the length (clockworklabs#19)
At the moment when we authenticate with the short-lived token we also
get the short lived token back. In order to not give it back to the
application let's just ignore the identity message token if we already
got one
* Initial commiut

* Update quickstart example

* Cleanup

* Update quickstart to use identity changes

* Remove misplaced files

* Switch generated folder name to match quickstart guide

* Switch generated folder name to match quickstart guide

---------

Co-authored-by: NateTheDev1 <[email protected]>
Co-authored-by: Derek Brinkmann <[email protected]>
* Add license.text

* Fix case on file name

---------

Co-authored-by: Derek Brinkmann <[email protected]>
When the primary key is of type Identity we were still doing ===
comparison by using the Map data structure. This commit introduces a
different data structure called OperationsMap which can also use isEqual
to compare keys if isEqual function is available
After the format of keeping the identity on the server was changed we
have to update how we serialize and deserialize Identity values
At some point identities were returned in a form of { __identity_bytes:
string } object. This commit changes the implementation to accept
regular strings as an argument because that's how we get all of the
identities now.
Remove `protobufjs` from devDependencies
Re: clockworklabs/SpacetimeDB#840

This commit updates the TypeScript SDK to no longer use the `row_pk` field
in the client API,
as that field no longer exists.

As in the other SDKs, we replace our use of the `row_pk`
with the serialized representation of the row,
as this saves our needing to have objects/dicts/hash-maps keyed on domain types.

Unlike the other SDKs, we support either the binary (protobuf) or JSON APIs.
When using the binary API, we convert the BSATN row to a string,
and use that as the `rowPk`.
When using the JSON API, we `JSON.stringify` the row itself, and use that as the `rowPk`.
The latter is ugly and not performant,
but we don't care because the JSON API is slow anyways.

This commit also removes some uses of `any` from the deserialization code,
because I wanted the compiler to double-check my work.
…alid tables (clockworklabs#32)

* Cleaned up code and added better error handling and responses for invalid tables

* Fixed breaking test

* Implemented new logging system

* made a small change to a WS error log
@bfops
Copy link
Collaborator

bfops commented Aug 7, 2025

This PR is quite old so I'm going to close it.

We're also now in the process of migrating this repo to the sdks/typescript subdirectory of SpacetimeDB. If there are still changes that need to be made, please open them in a PR there.

@bfops bfops closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants