0

I have an idea for an app, but it requires near-instant transmission (much less than 2 second delay) of an int 1-5000 to another device. The basic premise is that one user long-presses a button for a certain amount of time, I measure that time, then upon finger release display a picture on the other device for n milliseconds.

I also need to be able to scale this from 2 users to upto maybe 500 at the same time ideally? Or if that doesn't work "broadcast" the int to all device simultaneously, that's also acceptable.

I have done this successfully using TCP/UDP sockets and it worked great and smoothly, but only for 2 users at the same time. It hurts my brain trying to figure out how to scale it up, and the source code for that is long gone anyways, I could make it again in a couple days if sockets is the only solution, but trying to see if anyone has any other ideas.

So basically, what is the easiest and relatively low latency method to give my app running on another device an int? Even one word hints are highly appreciated.

I'm familiar with Android Development Studio and have basic (uni level) knowledge of java.

Leisure
  • 73
  • 1
  • 7
  • 1
    How far apart are the devices? Feet? Meters? Kilometers? What type of latency are you willing to accept? Can the data be sent to the other device within seconds? Minutes? Hours? What fidelity do you need- can you miss an update? Or do you absolutely need every one? You'd get different answers for all of those- and for some combos of answers you'd be told can't be done. For example perfect fidelity across internet distances in seconds isn't going to happen. You'd need to be willing to give up one of those things. – Gabe Sechan Jan 01 '23 at 06:54
  • the devices are on different continents (north america and asia). I can accept latency of up to 2 seconds but less is ideal. Yes I can miss updates no problem at all, don't need to transfer every single int, 16/20 is acceptable......... you can just pretend it's a very basic irc client.... the most important thing is a simple easy-to-code solution (just a hint, or starter code or api acceptable) – Leisure Jan 01 '23 at 06:57
  • 1
    I'm not very much of an expert but I would have considered using firebase's real-time database to send and receive data instantly. – Qasim Malik Jan 01 '23 at 09:34
  • 1
    looking into firebase, but just to simplify things all i want to do is 'ping' another device and have the other device trigger an event when it is pinged. surely there's something easier than setting up a DB? but i'm researching that too thanks! – Leisure Jan 01 '23 at 15:01
  • @QasimMalik there's no way you're getting that kind of latency out of Firebase. Not reliably. – Gabe Sechan Jan 01 '23 at 15:18
  • @GabeSechan yes, it's not that fast but after reading the comments on this question [here](https://stackoverflow.com/questions/37930219/is-firebases-latency-low-enough-to-be-used-for-realtime-mmog-instead-of-socket) I think it's ok to use it in this case, but if there's a better solution he should definitely go for that. – Qasim Malik Jan 01 '23 at 15:49

0 Answers0