universal-websocket-client

1.0.2 • Public • Published

Uses the native WebSocket client code in a browser and the ws package client on Node.js, enabling isomorphic applications to use WebSockets. Keeps your browser build slim, by not including any of the Node WebSocket implementation.

Installation

npm install --save universal-websocket-client

Usage

var WebSocket = require('universal-websocket-client');

\\ ... use the [WebSocket client interface](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).

On the client side, you'll now need to use browserify (or Webpack or something similar) to bundle your code.

See tests/browser and tests/node

Run Tests

These are end-to-end tests, that test the installed the package.

Node

cd tests/browser/
npm install
npm test

Browser

cd tests/node/
npm install
npm test

Then visit http://localhost:8000

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    17,758
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    17,758
  • 1.0.1
    102
  • 1.0.0
    0

Package Sidebar

Install

npm i universal-websocket-client

Weekly Downloads

13,799

Version

1.0.2

License

ISC

Unpacked Size

11.6 kB

Total Files

17

Last publish

Collaborators

  • gabrielgrant