C
C#2y ago
FusedQyou

❔ Best way to set up a websocket and API to access the data?

I'm working on a website that gathers data through a websocket on the backend, using raw UDP packets. The protocol indicates that I can request data, and then immediately receive that data in batches until a special code is retreived to indicate the end of the collection. I want to display this data on the frontend by calling an API to fetch it. The big challenge here is how I set up the backend to properly contain the data. I was thinking of having a background task occasionally fetch the data in an interval, and then have it store the data in a database. The API then always has this data available, or it will wait a bit whilst the newer batch is fetched. Would this be viable, or is there a better way to fetch the data and making sure the API always retrieves the data for the frontend? How can I properly create a background task that is invoked every 5 minutes so that I can fetch the data?
12 Replies
FusedQyou
FusedQyouOP2y ago
For reference, this is the protocol: https://wiki.zandronum.com/Launcher_protocol The initial set up is already done, and I can fetch a list of servers. I just need it to be done properly now.
Zandronum Wiki
Launcher protocol
This launcher protocol lets you to talk to servers and get information from them, allowing you to make your own custom programs like browsers, stat tools, and so on.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FusedQyou
FusedQyouOP2y ago
What? 🤔
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FusedQyou
FusedQyouOP2y ago
That doesn't explain it any better 😄 You're lost read websocket and UDP? I don't get it I have a backend, that must fetch data through a websocket, using raw UDP packets.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FusedQyou
FusedQyouOP2y ago
OH, wait yes I meant regular sockets lol I was initially thinking of Websockets but I can't use it here. I really can't modify the socket so I'm forced to use what it supplied. It's a socket communication with raw UDP packets.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FusedQyou
FusedQyouOP2y ago
My bad, totally misread
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FusedQyou
FusedQyouOP2y ago
No, it's an existing socket that I communicate with to fetch a list of servers, specified in the second message Yeah so basically you send a request and the socket immediatley responds with a bunch of packets. Eventually that stops and you can close the socket. There's no longevity or anything else to wait for So I went with Hangfire, and it seems to work properly. https://hatebin.com/lriqqrhquq Just can't figure out how to start the job immediatley I guess I can just activate it manually
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server