insomnia/packages/insomnia
Jack Kavanagh 812cd80740
bump: vite to v5 and fix (#7023)
* bump to v5 and fix

* change bundler back to node

* add fsevents to external?

* hacks

* note

* revert resolutions

* move gsap and nunjucks to front end code that is bundled by vite

---------

Co-authored-by: gatzjames <jamesgatzos@gmail.com>
2024-02-14 12:31:37 +01: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 bump: vite to v5 and fix (#7023) 2024-02-14 12:31:37 +01:00
.eslintignore
.gitignore Add pre-request tab and minimal execution context (#7065) 2024-02-09 10:51:55 +00:00
electron-builder.config.js bump: node 18.18.2 electron 28 (#6926) 2023-12-21 11:13:36 +01:00
esbuild.main.ts Add pre-request tab and minimal execution context (#7065) 2024-02-09 10:51:55 +00:00
esbuild.sr.ts bump: vite to v5 and fix (#7023) 2024-02-14 12:31:37 +01:00
jest.config.js chore: use npm workspaces (herecles) (#6193) 2023-08-10 00:14:16 +02:00
package.json bump: vite to v5 and fix (#7023) 2024-02-14 12:31:37 +01: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 Add pre-request tab and minimal execution context (#7065) 2024-02-09 10:51:55 +00: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 Add pre-request tab and minimal execution context (#7065) 2024-02-09 10:51:55 +00: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.