Hacker News new | past | comments | ask | show | jobs | submit login

I stopped using Phoenix a few years ago, but I'd do something roughly as follows:

- Imagine a grid where each cell is a 1x1 square mile based on lat/lon

- When a device moves to a new cell, have it join the phx-channel representing that 1x1 cell. It must also leave the previous phx-channel of the cell it occupied. If your devices move very slowly, have them recalculate the cell/channel they belong to once an hour (for example).

- When an anomaly occurs, send a message to the channel. Every device in that cell will receive the websocket message. You may also choose to send your message to the 3x3 cells that surround just the cell where the anomaly occurred.

- If you need to tell all devices something, use broadcast.

Feel free to change 1x1 mile to 1x1 meters or whatever.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: