Socket
Socket
Sign inDemoInstall

universal-websocket-client

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    universal-websocket-client

Use the same WebSocket client code in a browser or Node.js for isomorphic apps


Version published
Weekly downloads
22K
increased by0.47%
Maintainers
1
Install size
161 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 05 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc