Basic skeleton of side panel for WS frames
Categories
(DevTools :: Netmonitor, enhancement, P2)
Tracking
(firefox69 fixed)
Tracking | Status | |
---|---|---|
firefox69 | --- | fixed |
People
(Reporter: Honza, Assigned: tanhengyeow)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Implement basic skeleton for Messages side panel. This panel is responsible for rendering list of WS frames for selected HTTP WS upgrade request.
Some comments:
- The panel should start WS listening on the backend (through WebSocketFront.start API) in componentDidMount
- The panel renders list of frames in a table (HTML table). The initial list should be fetched through WebSocketFront.getFrames API
- The panel should support light/dark themes
- The panel should be hidden behind a pref
devtools.netmonitor.features.webSockets
- Check how it works in the Console panel (we might disable WS support in the Console in case of issues for now)
Honza
Reporter | ||
Comment 1•5 years ago
|
||
Some pointers:
-
Here is the current list of side panels
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/components/TabboxPanel.js#105-171 -
An existing side panel
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/components/HeadersPanel.js#71
Honza
Reporter | ||
Comment 2•5 years ago
•
|
||
Implementing WebSocketReducer should be part of this bug too.
There will also be new actions.
Actions to getFrame and add payload:
- WS_ADD_FRAME - this would be fired from DataProvider when a new frame (sent or received) is received from the backend
- WS_ADD_FRAME_PAYLOAD - this would be fired from WebSocketPanel when the user selects a frame in order to preview it’s payload. At this moment the LongStringActor (representing the payload) will be resolved and the action fired.
Honza
Reporter | ||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
Implement basic skeleton of side panel for WS frames.
Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c239c5218b5b Basic skeleton of side panel for WS frames. r=Honza
Comment 5•5 years ago
|
||
bugherder |
Comment 6•5 years ago
|
||
I've just tested this on github / https://socket.io where it works just fine.
However on https://web-whatsapp.com / https://discordapp.com/ no frames are displayed (Use Chrome for reference)
Comment 7•5 years ago
|
||
I've just tested this on github / https://socket.io where it works just fine.
However on https://web.whatsapp.com / https://discordapp.com/ no frames are displayed (Use Chrome for reference)
Reporter | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Summary of final patch:
-
Expose
channelId
from the backend to correlate the corresponding upgraded HTTP request with its WebSocket frames. -
Setup React (new
WebSocketsPanel
component) and Redux architecture (new actions/reducers/store/selectors). -
New Redux architecture in detail:
- Actions: Added
addFrame
function of typeWS_ADD_FRAME
that transmits thechannelId
and the WebSocket frame data. This action is executed fromFirefoxDataProvider
via theonFrameSent
andonFrameReceived
message handlers. - Store: New object named
WebSockets
that contains the framesMap
(key = channelId, value = array of frame objects). - Reducers: Handles the action of type
WS_ADD_FRAME
and updates theWebSockets
object with the new WebSocket frame mapped to achannelId
. - Selectors: Added
getFramesByChannelId
to fetch frames of a particularchannelId
. These frames would be displayed in theWebSocketsPanel
component.
- Actions: Added
-
New
WebSocketsPanel
component in detail:- If there are no frames in the
WebSockets
object aftergetFramesByChannelId
is called, the messageNo WebSocket frames for this request
would be shown. - If there are frames present for a
channelId
, a HTML table is used to display the frames in different rows. WebSocketsPanel
is only visible ifrequest.cause.type === "websocket"
and the prefdevtools.netmonitor.features.webSockets
is set.
- If there are no frames in the
Reporter | ||
Updated•5 years ago
|
Description
•