Socket
Socket
Sign inDemoInstall

universal-websocket-client

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

README.md~

2

package.json
{
"name": "universal-websocket-client",
"version": "1.0.0",
"version": "1.0.1",
"description": "Use the same WebSocket client code in a browser or Node.js for isomorphic apps",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

Uses the native WebSocket client code in a browser and the [ws package client](https://www.npmjs.com/package/ws) on Node.js
Uses the native WebSocket client code in a browser and the [ws package client](https://www.npmjs.com/package/ws) on Node.js, enabling isomorphic applications to use WebSockets. Keeps your browser build slim, by not including any of the Node WebSocket implementation.

@@ -8,3 +8,42 @@

```
npm install universal-websocket-client
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](http://browserify.org/) (or Webpack or something similar) to bundle your code.
See [`tests/browser`](blob/master/tests/node) and [`tests/node`](blob/master/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`](http://localhost:8000)

@@ -10,2 +10,3 @@ // Adapted from http://www.websocket.org/echo.html

var output;
var websocket;

@@ -12,0 +13,0 @@ function init()

@@ -7,6 +7,10 @@ {

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"pretest": "browserify index.js -o bundle.js",
"test": "python -m SimpleHTTPServer"
},
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"universal-websocket-client": "^1.0.0"
}
}

@@ -10,4 +10,4 @@ // Adapted from http://www.websocket.org/echo.html

var output;
var websocket;
function testWebSocket()

@@ -50,10 +50,5 @@ {

var colorMap = {
fgBlue:
fgRed:
}
function writeToScreen(message, color)
{
console.log('%s%s\x1b[0m', color, message); // append reset
console.log('%s%s\x1b[0m', color || '', message); // append reset
}

@@ -60,0 +55,0 @@

@@ -7,6 +7,9 @@ {

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node index.js"
},
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"universal-websocket-client": "^1.0.0"
}
}

Sorry, the diff of this file is not supported yet

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