Getting iterate updates from the server side Editor code

Getting iterate updates from the server side Editor code

Loren MaxwellLoren Maxwell Posts: 411Questions: 101Answers: 10

I have a form where the user will submit an entry and the server side Editor code will do the following steps in a validator:

1) Verify the entry maps to a valid Wikidata id
2) Retrieve some data from the Wikidata api
3) Retrieve some data from the Wikipedia api
4) Retrieve some data from the OpenStreetMap api
5) Perform some calculations with the OpenStreetMap data
6) Continue if all of the above is successful

The time from the submission to the final part usually takes about 3 or 4 seconds, but could take as many as 8 or 10 seconds depending on the response time for those apis.

I know I can throw an error if any of those steps fail, but what about a way to send iterate updates to the user about the progress of each step if it passes?

Such as:

- Found Wikidata ID!

Next:

- Found Wikidata ID!
- Retrieved Wikidata data!

Next:

- Found Wikidata ID!
- Retrieved Wikidata data!
- Retrieved Wikipedia data!

Next:

- Found Wikidata ID!
- Retrieved Wikidata data!
- Retrieved Wikipedia data!
- Awww man -- No OpenStreetMap entry :/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,872Questions: 1Answers: 10,527 Site admin
    Answer ✓

    Good question and I'll have a think about it. It would require a back channel to be able to be informed of the progress. That could be a web socket or an extra XHR. Either will add a lot of complexity to Editor though, which isn't really the direction I want to take it in. It could be built externally to the core library though.

    Allan

  • Loren MaxwellLoren Maxwell Posts: 411Questions: 101Answers: 10

    Thanks, @allan -- don't put too much thought into it if it's not something Editor can currently do.

    I was just checking to see if there was a way I wasn't aware of!

Sign In or Register to comment.