@swim/mesh implements a multiplexed streaming WARP client that runs in both Node.js and web browsers. @swim/mesh can be used in concert with the @swim/ui user interface toolkits to build massively real-time streaming applications. @swim/mesh is part of the broader @swim/system framework.
The @swim/mesh umbrella package depends on, and re-exports, the following component libraries:
@swim/mesh builds on the @swim/core framework; it has no additional dependencies when run in a web browser, and depends only on a WebSocket implementation when run in Node.js.
For an npm-managed project,
npm install @swim/mesh to make it a dependency.
TypeScript sources will be installed into
node_modules/@swim/mesh/lib/main. And a pre-built UMD script, which
bundles all @swim/mesh component libraries, can be found in
Browser applications can load
swim-mesh.js, along with its
dependency, from the SwimOS CDN.
<!-- Development --> <script src="https://cdn.swimos.org/js/latest/swim-core.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-mesh.js"></script> <!-- Production --> <script src="https://cdn.swimos.org/js/latest/swim-core.min.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-mesh.min.js"></script>
Alternatively, the standalone
swim-system.js script may be loaded
from the SwimOS CDN, which bundles @swim/mesh together with all other
<!-- Development --> <script src="https://cdn.swimos.org/js/latest/swim-system.js"></script> <!-- Production --> <script src="https://cdn.swimos.org/js/latest/swim-system.min.js"></script>
@swim/mesh can be imported as an ES6 module from TypeScript and other
ES6-compatible environments. All component libraries are re-exported by
import * as swim from "@swim/mesh";
@swim/mesh can also be used as a CommonJS module in Node.js applications.
All component libraries are re-exported by the umbrella
var swim = require("@swim/mesh");
When loaded by a web browser, the
swim-mesh.js script adds all component
library exports to the global
swim namespace. The
swim-core.js has already been loaded.
swim-system.js script also adds all @swim/mesh component library
exports to the global
swim namespace, making it a drop-in replacement
swim-mesh.js when additional @swim/system frameworks are needed.