0

example code below:

client = new EoswsClient(createEoswsSocket(() => new ws(`wss://${config.dfuse.endpoint}/v1/stream?token=${config.dfuse.token}`, { origin: config.dfuse.origin })));
    await client.connect();
    client.getActionTraces({ accounts: "eoscontract1" }).onMessage(onMessage);
    client.getActionTraces({ accounts: "eoscontract2" }).onMessage(onMessage);

I'm getting the following Error-Message: enter image description here

Does this mean that if I want to stream 2 different actions for two different accounts, I would have to instantiate two EoswsClient-instances and to establish two connections?

Here is the context that I set for the stream:

const undelegatebw = {
  accounts: accounts.join("|"),
  receiver: receivers.join("|"),
  //   action_names: "voteproducer,delegatebw,undelegatebw"
  action_names: "undelegatebw"
};
const voteproducer = {
  accounts: accounts.join("|"),
  receiver: receivers.join("|"),
  //   action_names: "voteproducer,delegatebw,undelegatebw"
  action_names: "voteproducer"
};
await dfuseWs.getActionTraces(undelegatebw, options, undelegatebwHandle);
await dfuseWs.getActionTraces(voteproducer, options, voteproducerHandle);
0

You have to use two different req_id's if you want to receive specific actions of two contracts.

await dfuseWs.getActionTraces({ accounts: "eoscontract1", action_names: "undelegatebw" }, { req_id: "A" }).onMessage(...);
await dfuseWs.getActionTraces({ accounts: "eoscontract2", action_names: "voteproducer" }, { req_id: "B" }).onMessage(...);

If you want to receive action-traces for every action of both contracts you don't even need to send two requests.

await dfuseWs.getActionTraces({ account: "eoscontract1|eoscontract2"}).onMessage(...);
| improve this answer | |
  • 1
    If this is the case, say if I listen to voteproducer and delegatebw separately, can dfuse guarantee that the actions that I receive on both requests is in the right timely order? – Anthony Mar 28 '19 at 15:54
  • Not sure if they can "guarantee" that, you should probably ask in their channel. My personal experience is that it works very well and I personally havn't had any problems with the order of transactions for know and the behaviour/order of respopnses, if it's a normal, inline or deferred trx always seems to be predictable. Same for table-deltas. – cmadh Mar 28 '19 at 16:00
  • 1
    No, two streams are not connected together and runs concurrently, ordering is guaranteed only inside a single stream. When two streams are registered, the messages can arrive in any order is you were to "fusion" the streams. – Matt Mar 28 '19 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.