Skip to content
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

Initial WebSocket support #5043

Merged
merged 48 commits into from
Sep 9, 2022
Merged

Initial WebSocket support #5043

merged 48 commits into from
Sep 9, 2022

Conversation

gatzjames
Copy link
Contributor

@gatzjames gatzjames commented Aug 4, 2022

Decision to make before merge:

Nitpicks

  • reverse event log
  • dupe connection success race condition
  • remove send message event from timeline
  • rename icn-ellipsis-circle2.svg -> icn-checkmark-circle.svg

naming decision notes:

  • two words "WebSocket", "web-socket", "web_socket", "webSocket"
  • one word, with an abbreviation exception "WebSocket", "websocket", "WS"
  • redux implementation forces us to be inconsistent, it lowercases the first letter of the model type and forces us to set the model type to WebsocketRequest creating an exception. Proposal -> Proposal/conventional-websocket-naming #5158
  • default decision is for filenames to be treat websocket/s as one word and variables and types to treat W/webSocket as two words.

@jackkav jackkav marked this pull request as ready for review September 9, 2022 11:54
dimitropoulos and others added 24 commits September 9, 2022 13:55
* wip

* add fail safe

Co-authored-by: Mark Kim <mark.kim@konghq.com>
* add url to ws-request model

* fix webSocketRequest typo and add url

* add websocket api and expose it through preload ipc

* add typings

Co-authored-by: Mark Kim <mark.kim@konghq.com>
* add websocket action bar and its components

* remove comments

* clean up

* reflect on the electron api

* remove unused files

* import name change

* add styling

* remove commet

* add suggested changes

* remove default value
* add websocket actions dropdown

* add actions to websocket request in sidebar
* Update event types to improve inference

* Update websocket response pane to fetch/subscribe and display the events
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
* add initial changes for websocket message

* add abstraction for db operation and websocket operation

* remove console

* add rename

* add basic testing

* add basic testing

* add unit tests

* add form event type

* add comments

* disallow exporting context directly

* add suggested changes

* refresh the query

* using useDeepCompareEffect

* rename variable

* add mock

* clean up

* clean up

* correct the file name

* add some changes

* removing nedb-context and its hooks

* remove database changes for event sending
* save changes

* add styles and move files around

* remove unused code

* clean up some components

* add clean up

* add timestamp component

* add unit tests

* add case

* add style changes
* first ui pass

* extract and wire up bulk editor

* raise ready state, move send

* add upgrade header debug logs

* can pass header to websocket upgrade

* implement readOnly headers

* add upgrade event and sent headers

* clean up

* fill out http upgrade into the event

* change upgrade message

* read only headers while connected

* remove upgrade event

* revert bulk editor change

* fix header editable toggle

* add nunjucks todos

* improve readOnly implementation

* disable codemirror/nunjucks for websocket headers

* take calculated headers out of the data model

* move hardcoded default headers down the tree

* fix request url rendering issue

* removed spammy warning

* clarify prop name

* refine pair typing

* change placeholder

* remove readOnly header property

* fix readOnly header layout
* first pass as event

* add handshake ui

* add timeline tab

* simplify ResponseTimelineViewer

* transform res debug modal to change timeline props

* decouple timeline fetching from timeline component

* timeline ui pass

* record headers in request and response models

* can view timeline history

* write timeline to file

* some timeline

* can persist event logs

* put interface beside usage

* add note

* add event log history

* remove table event row

* tidying up

* make ws colors match

* enable multiple open connections

* close open connections at app exit

* remove old test

* Update packages/insomnia/src/models/request-version.ts

* fix type

* default readystate

* fix preview css scroll

Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* INS-1788: Add control flow for responsiveness.

This prevents events from flooding the UI thread entirely.

* Add additional code comments.

* fixup: webSocketEvent -> webSocketEvents
* remove unused context provider

* show errors in event tab

* updates timeline with message and close

* clean up

* show errors in timeline

* fix WebSocket capitalisation

* make timeline reader specific to ws

* write outbound messages to the timeline

* fix type
* close ws connection when response is changed

* add delete logic for the queue mapg

* set error response to active response

* useRef for CodeEditor

* extract closeRequest

* use requestId to eliminate inconsistencies

* refactor extract clean up methods

* timeline feedback

* change type annotation

* fix type

* Revert "use requestId to eliminate inconsistencies"

This reverts commit 98335a9.

Co-authored-by: Mark Kim <mark.kim@konghq.com>
* hard code sending and storing to true

* make tab naming consistent

* hard code cookie settings to false

* fix headers isDisabled bug
* add minimal change to the auth flow

* add disable state

* adding dropdown disable

* simplify reducer

* fix lint

Co-authored-by: jackkav <jackkav@gmail.com>
jackkav and others added 21 commits September 9, 2022 13:55
…ction (#5120)

* add auth to the header

* remove console log

* remove unneeded async

* add success redirect logic to websocket server

* add unexpected-response handler

Co-authored-by: jackkav <jackkav@gmail.com>
* add status related changes

* text label change
* make consistent with main bridge

* rename webSocket

* remove deviated mock

* use consistent arrow function defintions

* Update packages/insomnia/src/main/network/websocket.ts

Co-authored-by: James Gatz <jamesgatzos@gmail.com>

Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* Fix failing websocket smoke test

* Add remaining websocket smoke server endopints to fixtures

* Add checks for basic-auth, bearer and redirect

* Rm assertion
* INS-1844: Implement basic event view functionality

* CSS fix to align Preview button with tab buttons.
* Reverse the event log order in the view and subscribe to messages after the latest
* init websocket-response model

* add websocket response model

* remove unused timeline getter

* remove unused functionality from the ws-response model
* add empty state

* use the empty state pane

Co-authored-by: gatzjames <jamesgatzos@gmail.com>
* just poll

* remove cts and eventlog channel
* remove unused names

* fix copypasta icon

* ensure all subcompnent drop state on request change

* move empty state to response pane
@jackkav jackkav enabled auto-merge (squash) September 9, 2022 14:30
Copy link
Member

@filfreire filfreire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackkav jackkav merged commit 0373bb5 into develop Sep 9, 2022
@jackkav jackkav deleted the websockets branch September 9, 2022 14:53
environmentId,
}) => {
const editorRef = useRef<UnconnectedCodeEditor>(null);
useEffect(() => {
let isMounted = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what was the reason for this check for isMounted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-websockets Area: Websockets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants