IoTtalk / iottalk-py

IoTtalk v2 Python SDK
MIT License
0 stars 6 forks source link

DAI auto push #4

Closed Ksoy closed 4 years ago

Ksoy commented 5 years ago

待 #2 完成後,再做調整。
現在的 DAI 當收到連線訊息後,會主動建立 thread 去定期向使用者定義好的 idf function 取值並 push 到 esm。

應提供使用者可自行決定要以 DAI 自行定期主動 push,或是使用者自行決定何時要呼叫 push

iblislin commented 4 years ago

這個我們有設計 API 了嗎?

Ksoy commented 4 years ago

還沒

iblislin commented 4 years ago

@Ksoy, @Zane2453 說要用這個 feature

iblislin commented 4 years ago

現在第一個情境:

@Zane2453 需要開一個 WS socket 來聽 WS event,IDF 會根據這個 event 來 push 資料

iblislin commented 4 years ago

我想主動 Push 基本上都是 event driven? @Ksoy 你有沒有想到其他 case?

Ksoy commented 4 years ago

都是 event driven 吧,一定有某個條件讓使用者想去 push
可是依現在的 dan 來看,有點想不太到要怎麼做這件事
main thread 不在 sa code上,有點難讓使用者自行呼叫

iblislin commented 4 years ago

簡單來說, 目前也是某種 event driven,是 sleep 的 event。

主要就是抽象化這個 while 掉即可。

https://github.com/IoTtalk/iottalk-py/blob/8f304097db9ca596b86f588da4e58d496b429334/iottalkpy/dai.py#L67-L75

iblislin commented 4 years ago

定個 API 我改?

Zane2453 commented 4 years ago

https://github.com/Zane2453/Frame_Web/blob/master/Weather.py