insomnia/packages/insomnia
2023-11-22 16:45:27 +00:00
..
bin chore: use npm workspaces (herecles) (#6193) 2023-08-10 00:14:16 +02:00
config Chore/flatten-plugins-cont (#6186) 2023-07-25 10:37:04 +02:00
scripts setup new versioning for release-start (#6244) 2023-08-10 11:04:28 +02:00
send-request
src refactor: add error route with override message (#6837) 2023-11-22 11:42:50 -05:00
.eslintignore
.gitignore
electron-builder.config.js Do not package build-id metadata for RPM target (#6688) 2023-10-13 16:09:39 +02:00
esbuild.main.ts
esbuild.sr.ts Electron 23 upgrade (#5987) 2023-06-29 18:02:02 +02:00
jest.config.js chore: use npm workspaces (herecles) (#6193) 2023-08-10 00:14:16 +02:00
package.json Bump app version to 8.4.3 2023-11-22 16:45:27 +00:00
postcss.config.js Tailwind (#6189) 2023-08-01 12:04:15 +03:00
README.md Insomnia Sync improvements (#6738) 2023-11-06 15:24:51 +01:00
svgr.config.js
tailwind.config.js Tailwind (#6189) 2023-08-01 12:04:15 +03:00
tsconfig.build.json Chore/fix-install-warnings (#6243) 2023-08-10 13:37:37 +02:00
tsconfig.build.sr.json
tsconfig.json Chore/fix-install-warnings (#6243) 2023-08-10 13:37:37 +02:00
vite-plugin-electron-node-require.ts Bump/linters (#6128) 2023-07-10 23:54:42 +02:00
vite.config.ts fix lint 2023-08-10 13:38:37 +02: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.