/wdg/ - Web Development General

Sir we are merely doing the needful

Do you wanna know why? Because there are CONSTANTLY new people here. Most of the people you see are probably only active a few months.
So these new people discovered this meme for the first time and made it huge.
I hope I didn't destroy your illusions.

Attached: 20190917190109.png (197x164, 9K)

It might mean the data you ask for cannot be provided quick enough. They might need to do some long running computation to generate the numbers.

So keeping the connection alive would unnecessarily consume resources which could be used to accept newer requests. Instead they ask for a callback URL which is an endpoint that you control where they can send the results once they have been generated.

Thanks. So how would I factor this in with, say, a userscript?

React Hooks are a fucking joke. Much less readable and more code than class components.

The exact opposite is true. Are you sure you're using hooks properly?

To create callback you will need to run a server. It can be done with JavaScript easily if you use server side stuff like nodejs.

Userscript would be JavaScript running in a web browser, and I don't think it would be possible to run a server on top of a browser.

be so kindful, do the needful, make me goodful

Blazor is the future

The callback URL needs to be accessible on the internet, so you'd need to write some serverside code to handle it. I'm not sure what a userscript is but I assume you mean like a browser extension?

I'd recommend writing a simple node.js HTTP web server that is also a websocket server (use socket.io or SignalR or something) that your userscript clients can make a persistent connection to, that can handle the callbacks from the API and forward them to the correct client over the websocket. This has the benefit of keeping this asynchronous via a proxy.

You could also ditch the websockets and just cache the API responses in a database, then write your own simple API that you can poll until the data is available.