# @remixproject/engine-web

> The web engine provides a connector for Iframe & Websocket. `npm install @remixproject/engine-web`

Latest version **0.3.38** (published 2023-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @remixproject/engine-web
pnpm add @remixproject/engine-web
yarn add @remixproject/engine-web
bun add @remixproject/engine-web
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.38 |
| Published | 2023-06-26 |
| First published | 2020-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 28 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 188 |
| Author | GrandSchtroumpf |
| Maintainers | grandschtroumpf, yann300, lianahus, aniket-engg, bunsenstraat, ioedeveloper |

## Links

- npm: https://www.npmjs.com/package/@remixproject/engine-web
- Repository: https://github.com/ethereum/remix-plugin
- Homepage: https://github.com/ethereum/remix-plugin/tree/master/packages/engine/web#readme
- Issues: https://github.com/ethereum/remix-plugin/issues
- npm.io page: https://npm.io/package/@remixproject/engine-web

## Dependencies (3)

- [@remixproject/engine](https://npm.io/package/@remixproject/engine.md) 0.3.38
- [@remixproject/plugin-api](https://npm.io/package/@remixproject/plugin-api.md) 0.3.38
- [@remixproject/plugin-utils](https://npm.io/package/@remixproject/plugin-utils.md) 0.3.38

## Recent versions

- 0.3.38 (latest) — 2023-06-26
- 0.3.44 (next) — 2024-12-19
- 0.3.11-alpha.5 (canary) — 2021-04-01
- 0.3.43 — 2024-03-06
- 0.3.42 — 2023-12-09
- 0.3.41 — 2023-12-09
- 0.3.40 — 2023-12-08
- 0.3.39 — 2023-12-08
- 0.3.37 — 2023-06-07
- 0.3.36 — 2023-06-07
- 0.3.35 — 2023-06-07
- 0.3.34 — 2023-06-02
- 0.3.33 — 2023-02-14
- 0.3.32-alpha — 2023-02-13
- 0.3.31 — 2022-07-11
- … 78 more at https://npm.io/package/@remixproject/engine-web/versions

## README

# Engine Web
The web engine provides a connector for Iframe & Websocket.
`npm install @remixproject/engine-web`

## Iframe
The iframe connector is used to load & connect a plugin inside an iframe.
Iframe based plugin are webview using an `index.html` as entry point & need to use `@remixproject/plugin-iframe`.

```typescript
const myPlugin = new IframePlugin({
  name: 'my-plugin',
  url: 'https://my-plugin-path.com',
  methods: ['getData']
})
engine.register(myPlugin);
// This will create the iframe with src="https://my-plugin-path.com"
await manager.activatePlugin('my-plugin');
const data = manager.call('my-plugin', 'getData');
```

> Communication between the plugin & the engine uses the `window.postMessage()` API.

## Websocket
The websocket connector wraps the native [Websocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) object from the Web API.
Websocket based plugin are usually server with a Websocket connection open. Any library can be used, remixproject provide a wrapper around the `ws` library : `@remixproject/plugin-ws`.

```typescript
const myPlugin = new WebsocketOptions({
  name: 'my-plugin',
  url: 'https://my-server.com',
  methods: ['getData']
}, {
  reconnectDelay: 5000 // Time in ms to wait to reconnect after a disconnection 
});
engine.register(myPlugin);
// This will open a connection with the server. The server must be running first.
await manager.activatePlugin('my-plugin');
const data = manager.call('my-plugin', 'getData');
```

---
_Source: https://npm.io/package/@remixproject/engine-web · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
