insomnia/packages/insomnia
James Gatz 1a80b25ce5
fix(key-value editor): Fix locked focus when the autocomplete is open and improve styling (#7597)
* Fix locked focus when the autocomplete is open and improve styling

* add await to delay snippet

* display the workspace name on global environments
2024-06-27 10:12:34 +00:00
..
bin
config point changelog url at releases (#7387) 2024-05-09 09:40:41 +00:00
scripts
send-request
src fix(key-value editor): Fix locked focus when the autocomplete is open and improve styling (#7597) 2024-06-27 10:12:34 +00:00
.eslintignore
.gitignore
electron-builder.config.js add note about notorize fail 2024-06-26 12:36:08 +02:00
esbuild.main.ts perf: improve performance when spec lint [INS-3724] (#7374) 2024-05-14 14:56:53 +08:00
esbuild.sr.ts
jest.config.js
package.json Bump app version to 9.3.0-beta.7 2024-06-26 09:58:57 +00:00
postcss.config.js
README.md
svgr.config.js
tailwind.config.js feat(Auth screen): Improve copy and add animation (#7429) 2024-05-17 13:16:13 +02:00
tsconfig.build.json
tsconfig.build.sr.json
tsconfig.json
vite-plugin-electron-node-require.ts
vite.config.ts perf: improve performance when spec lint [INS-3724] (#7374) 2024-05-14 14:56:53 +08:00

Insomnia

The main desktop application.

Data fetching

  • To fetch data from our APIs we use the insomniaFetch function. This allows us to overcome cross-origin issues and helps us to standardize the way we fetch data and also to handle errors in a centralized way.

  • For real-time data fetching we use SSE (Server-Sent Events). This is a standard way to receive data from the server in real-time. The server will send a message to the client when something happens. The client will receive the message and update the data accordingly. To handle SSE we use the insomnia-event-source:// protocol which is a custom protocol that gets handled by the app in the main process. This allows us to overcome cross-origin issues and also to handle SSE in a centralized way.

  • Polling is also used to fetch data from the server. This is used when we need to fetch data periodically as SSE can sometimes fail and data can go out of sync. The main places we use polling are:

    • Refreshing Insomnia Sync data.
    • Refreshing Git Sync data.
    • Refreshing Presence data.

⚠️ Using a combination of SSE and polling we can keep the data in sync and up to date but might also lead to some race conditions. For example, if we are polling for data every 5 seconds and the server sends an SSE message at the same time, the data might be out of sync for a few seconds. This is something we need to keep in mind when using SSE and polling.