MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / Subscribe

Method Subscribe

sdks/csharp/src/SpacetimeDBClient.cs:896–918  ·  view source on GitHub ↗
(ISubscriptionHandle handle, string[] querySqls)

Source from the content-addressed store, hash-verified

894 }
895
896 QuerySetId? IDbConnection.Subscribe(ISubscriptionHandle handle, string[] querySqls)
897 {
898 if (!webSocket.IsConnected)
899 {
900 Log.Error("Cannot subscribe, not connected to server!");
901 return null;
902 }
903
904 var id = stats.SubscriptionRequestTracker.StartTrackingRequest();
905 // We use a distinct ID from the request ID as a sanity check that we're not
906 // casting request IDs to query IDs anywhere in the new code path.
907 var querySetId = querySetIdAllocator.Next();
908 subscriptions[querySetId] = handle;
909 webSocket.Send(new ClientMessage.Subscribe(
910 new Subscribe
911 {
912 RequestId = id,
913 QuerySetId = new QuerySetId(querySetId),
914 QueryStrings = querySqls.ToList(),
915 }
916 ));
917 return new QuerySetId(querySetId);
918 }
919
920 /// Usage: SpacetimeDBClientBase.instance.OneOffQuery<Message>("SELECT * FROM table WHERE sender = \"bob\"");
921 [Obsolete("This is replaced by ctx.Db.TableName.RemoteQuery(\"WHERE ...\")", false)]

Callers

nothing calls this directly

Calls 4

StartTrackingRequestMethod · 0.80
NextMethod · 0.80
ErrorMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected