-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for Connection(websocket, buetooth) management in the mobile app [w36] #787
Comments
Hi man, i am here! WIP, stay tuned? |
Looks solid, one thing here, let's have a metric of success
|
agreed! |
Week # 36 |
A case to be considered: https://dashboard.instabug.com/crashes/vL5FR_EExZlyXOj8tT-ivw |
Updates:
|
Thinh here! So, what is this?
You know that our app (Omi) is a fast draft version. We focused on making it work first, but now we need to scale it, preparing for 100k users in the near future.
Let's focus on the most important part of Omi first: connection management. Why? Because the core of Omi is to connect to the world (of devices, services) — like Friend Necklace, OpenGlass, Frame, and much more.
Objective
Key Results
How to solve it
I won’t dwell on how bad it currently is; instead, we’ll focus on how good it can be. I'll move quickly to make it happen on the Omi app ASAP.
A/ Principles
B/ Implementation
Core layers:
KeepAlivedConnection
: The base class forWebSocketConnection
,BluetoothConnection
, and evenInternetConnection
.open()
close()
read()
write()
subscribe(event, context)
unsubscribe(event, context)
KeepAlivedService(pool, connections)
KeepAlivedServiceManagement(pools)
: (KASM) follows the singleton pattern — only one instance at the global level. Its responsibility is to manage service instances (via pools) and the states between them.init()
anddispose()
must be called at the main level.init()
dispose()
socket()
ble()
internet()
How to use it?
kasm.socket()
-> to get a socket connection instance, then subscribe, read, write, unsubscribe.kasm.ble()
-> to get a BLE connection instance, then subscribe, read, write, unsubscribe.kasm.internet()
-> to subscribe the internet status changesThe text was updated successfully, but these errors were encountered: