Xeio / WanderLost

Lost Ark Wandering Merchant Tracker
MIT License
107 stars 36 forks source link

Licence for community contributions #87

Closed mchangrh closed 2 years ago

mchangrh commented 2 years ago

Thanks for this service, I've been using the call interfaces and a signalR client to roll an integration and was wondering what the licence is for the data on the website and subsequently, the websocket.


As the result reference in #75 has helped tremendously, here are my TypeScript typings

type ActiveMerchantGroup = {
  id: number,
  server: string,
  merchantName: string,
  activeMerchants: ActiveMerchant[]
}

type ActiveMerchant = {
  id: string,
  name: string,
  zone: string,
  card: {
    name: string,
    rarity: number
  },
  rapport: {
    name: string,
    rarity: number
  },
  votes: number
}

enum CardRarity {
  Common = 0,
  Uncommon = 1,
  Rare = 2,
  Epic = 3,
  Legendary = 4  
}
Xeio commented 2 years ago

The whole repo is MIT seen here. Nothing specific on connecting, though I just ask you try not to spam it. Ideally listening for push events is more efficient than polling though you do need to make sure you handle re-connect cases and re-subscribe to the servers when that happens (should be rare-ish nowadays, but usually it's 1-3 minutes when I do a deployment every other day or so at this point).

I have the site clients a bit liberal with the reconnect windows mostly to avoid annihilating my server like I used to, and with a large window so if I mess up they should still reconnect as long as I don't have some horrible 25+ minute downtime. 😅 You probably don't need to mirror most of that, since some of the things like MessagePack probably won't even work from non .Net how I have the server configured.

mchangrh commented 2 years ago

I tried to port your signalR connection as best as I could but keepAlive doesn't work with my client so I send a HasNewerClient request every 5 minutes with a timeout of 10mins, I hope that's okay.

I'm handling disconnects manually but I'll try to port your WithAutomaticReconnect

since signalR only returns the server name from UpdateMerchantGroup I end up having to send a GetKnownActiveMerchantGroups, I tried debugging the websocket but had no such luck, please let me know if I'm missing anything

Xeio commented 2 years ago

Yeah, that's probably fine, HasNewerClient is about as close to free as it can get if you just want to use that as a keep alive.

You may not need to worry about the reconnections as much, like if it's just your client you can retry immediately (though probably back off after the first retry), just might want to make sure the total window is 10-20 minutes before you start potentially hard-failures since that's usually what I assume clients have for when I'm messing with deployments.

Strange about the UpdateMerchantGroup. In theory that should be feeding two parameters to the client, the first is the server name then the second is the group data. Is the client not reading them both?

mchangrh commented 2 years ago

In theory it should be feeding two parameters but the overload doesn't pick it up, I'll try again next cycle.

Ah now they're coming through on the overload - one less call :)

Xeio commented 2 years ago

Also FWIW, if you ever need to experiment you can use https://test.lostmerchants.com/MerchantHub.

I only don't make any guarantees that I won't take that one down at random, or have weird things deployed to it, but you can at least sort of test submitting junk and watching it stream back without getting yourself banned from the main site.

Xeio commented 2 years ago

Just FYI , if you are listening to the UpdateVoteTotal message, this is going to be changed to send updates in a batch rather than one at a time, probably tonight sometime when the server is at off-peak hours. It's available on https://test.lostmerchants.com/MerchantHub as of now.

See the bottom here for change to API

Normally would prefer not to do a change that breaks like this, but having some performance issues due to more clients => more votes => exponential growth in vote message broadcasts. If I try to do compatibility it'll just increase the messages by double or so during the holdover period which likely will exacerbate the problem.

mchangrh commented 2 years ago

Thanks for the heads up! Not currently listening for it but will keep it in mind if I do.

mchangrh commented 9 months ago

In my spring cleaning, I have made my bot public under GPLv3 at https://github.com/mchangrh/cardwatch. It worked wonders for the time it was up and I'm making it public as a thank you for the project ❤️