-
Notifications
You must be signed in to change notification settings - Fork 7
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
feature/websocket history #246
Conversation
7869af7
to
c5bf7f9
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c5bf7f9
to
5e9cd5f
Compare
5e9cd5f
to
48d6541
Compare
48d6541
to
c44d491
Compare
c44d491
to
76c2602
Compare
76c2602
to
4337fbf
Compare
Hello @Yuwen-ctw , 在這次 PR 中你在原有的 ApiHistoryProvider 改寫為 HistoryProvider 並在其中擴充了 WS 事件,並將現有有 emit 的地方封裝成 Function 利於做 addWsHistory,其實我也覺得封裝起來比較好,未來 emit 事件多了之後也可以明確定義回來的 datatype 長怎樣,例如:
功能上實測是沒有問題的!對於在補充提到的,
這邊或許可以在 SockeyProvider 中使用 socket.onAny(callback),如此一來就能在 Provider 進行 addWsHistory,看起來比較乾淨。
最後,我想要考慮與預防的點有以下兩點:
這邊我就沒有多加測試了,謝謝! |
4337fbf
to
0fd29ed
Compare
Kudos, SonarCloud Quality Gate passed!
|
✅ Knip Scan Result for 0fd29ed Unused files (10)
Unused dependencies (2)
Unused devDependencies (5)
Configuration issues (1)
|
🤖 Lighthouse Scan Result for 0fd29ed /rooms
/rooms/abc
/login
|
Hello @ttpss930141011 , 而有關於兩點提到的疑慮,針對第一點個人的想法是,API 與 WebSocket 的歷史紀錄功能目前都僅用於開發模式,因此監聽所有事件也有利於觀察開發時是否有意料之外的狀況;另一個觀點是,我們應該可以相信後端不會發送前端不在意的事件過來,如果有發生此狀況也有利於即早發現並探究原因。而針對第二點,目前觀察下來 connect 與 disconnect 是不會被 socket.onAny 監聽到的。 以上說明,可以再討論,感謝! |
Why need this change? / Root cause:
Changes made:
<WsHistoryItem>
component and its svgs<ApiHistoryList>
component to apply<WsHistoryItem>
addWsHistory
function inApiHistoryPorvider
addWsHistory
inChatRoomProvider
Test Scope / Change impact:
Issue
補充
此 PR 分兩個提交:
第一個提交是依照現行 Socket.IO 版本實作出可以紀錄連線、發送與接收訊息的功能。
第二個提交則僅修改原本前綴為 ApiHistory 的檔案名稱與變數名稱,調整為較通用的 Hitory,並刪除原本的 ws 套件。
Review 時,可優先審閱第一個提交,方便釐清為開發本功能而修改的部分。
以上說明,謝謝!