insomnia/packages/insomnia
Jack Kavanagh 3fec8698d1
Markdown-inlined (#7554)
* markdown

* add inline docs

* can save

* default preview mode

* simplify

* fix tests

* fix types

* full panel layout

* fix e2e test
2024-06-21 12:17:00 +02:00
..
bin chore: remove repetitive words (#7223) 2024-04-02 10:06:46 +02:00
config point changelog url at releases (#7387) 2024-05-09 09:40:41 +00:00
scripts bump node and electron versions (#7203) 2024-04-11 12:49:58 +00:00
send-request
src Markdown-inlined (#7554) 2024-06-21 12:17:00 +02:00
.eslintignore feat(prereq): add simple timeout (#7079) 2024-03-01 13:17:21 +01:00
.gitignore feat(prereq): add simple timeout (#7079) 2024-03-01 13:17:21 +01:00
electron-builder.config.js
esbuild.main.ts perf: improve performance when spec lint [INS-3724] (#7374) 2024-05-14 14:56:53 +08:00
esbuild.sr.ts bump node and electron versions (#7203) 2024-04-11 12:49:58 +00:00
jest.config.js
package.json Bump app version to 9.3.0-beta.6 2024-06-20 10:43:20 +00:00
postcss.config.js feat(Insomnia-Sync): Add diff view (#7152) 2024-03-08 17:15:15 +01:00
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.