Can I fetch all parties via the streaming api?

I would like to use the streaming equivalent of the /v1/parties endpoint.

I cannot see any hint on this in the documentation: https://docs.daml.com/json-api/index.html#streaming-api

And the v1/stream/parties endpoint doesn’t seem to work. I was trying with this code, as an analogy to the example code snippet in the docs:

const tokenPrefix = "jwt.token.";
const jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJjcmVhdGUtZGFtbC1hcHAtc2FuZGJveCIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.ahT0RApOdZlrC5u0BH7ybdQcYY_DKLDQkdPCK8dz3R4";
const subprotocols = [`${tokenPrefix}${jwt}`, wsProtocol];
const ws = new WebSocket("ws://localhost:7575/v1/stream/parties", subprotocols);
 
ws.addEventListener("message", function incoming(data) {
		app.ports.partiesStream.send(event.data);

	});

The error message is:

WebSocket connection to 'ws://localhost:7575/v1/stream/parties' failed: Unexpected response code: 404

The v1/stream/query end point works.

Is this streaming endpoint not supported?

1 Like

There is no streaming version of the parties endpoint at this point. This applies to both the gRPC Ledger API as well as to the JSON API. So for now, you have to keep polling to discover new parties.

3 Likes

Thank you!