Giter Club home page Giter Club logo

Comments (1)

ltfschoen avatar ltfschoen commented on August 16, 2024

For users using a web browser on the same device consider using a SharedWorker incase the user had multiple browser windows open https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker rather than just a standard web workerWorker?

But since the user might be accessing the app on multiple devices at the same time (web browser X on device A, web browser Y on device A, android app on device B), i think we'd need to setup a server, where each frontend checks the device location using HTML5 Geolocation API and sends it to the server which is where we'd update the latest location and check if their location and that of other relevant users has changed.

I'm not sure how to handle if a different location is sent from different devices that they're logged in to, maybe in settings they configure which device(s) they want use to share their location, and we'd otherwise have to detect which device is most likely active by prioritising the device where latest UI interaction has occurred, and we'd store that server-side.

On the server-side we'd allow sufficient time using setInterval for each of the possible devices that they've registered that they could be using to have shared their latest location from) and after that interval we'd respond as to whether their location has changed or if any of their contacts is nearby, by emitting the data broadcasting it to each client over a websockets, and that'd be received by a websockets connection on each client. i'm not sure whether we'd use 'polling' or 'websockets' for the transport (i.e. http://localhost:3000/socket.io/?EIO=4&transport=polling) https://socket.io/docs/v3/client-initialization/.

Then we'd integrate data received on the client-side via websockets with the client-side web workers (i.e. SharedWorker) like shown here https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker for web browser implementations

I also think we'd need to setup a server since it might reduce the risk of exposing their location and where their data is being stored.

from lets-stay-in-touch.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.