Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ws-additions

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ws-additions - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

src/awesome-websocket.litcoffee

2

index.js
module.exports.ReconnectingWebSocket = require("./src/reconnecting-websocket.litcoffee");
module.exports.AwesomeWebSocket = require("./src/hunting-websocket.litcoffee");
module.exports.AwesomeWebSocket = require("./src/awesome-websocket.litcoffee");
{
"name": "ws-additions",
"version": "0.0.9",
"version": "0.0.10",
"description": "Helpful additional functionality for the vanilla WebSocket.",

@@ -5,0 +5,0 @@ "keywords": [

# WebSocket Additions
## Home of the AwesomeWebSocket

@@ -10,3 +11,3 @@ ### What is this thing?

WebSockets should do some stuff out of the box that they don't, this package
attempts to add that.
attempts to add that stuff.

@@ -36,16 +37,7 @@ ##### blowhard

### ASSumptions
It turns out we can make some assumptions in this whole process that make development
a little easier, but may change the way you interact with WebSockets when you
use this package.
* If you're using these it's because you want the websocket to do some useful
things for you, so you don't have to do them yourself, thus you're willing to
give up some of the 'raw' WebSocket interface elements.
### You sure it works?
While the only place this currently has been tested is in Chrome (newish versions)
and nodejs, there are some QUnit tests available to prove it does (or doesn't)
work.
While the only place this currently has been tested is in Chrome and Safari
(newish versions), there are some QUnit tests available to prove it does
(or doesn't) work.

@@ -63,2 +55,3 @@ ```bash

* `http://localhost:8080/keepalive.html`
A bunch of these tests blow up the server ( by design ) so it's hard to get them

@@ -127,2 +120,3 @@ all to run at the same time ( hence the multiple pages ).

npm install ws-additions
browserify -r ws-additions --outfile www/js/reconn.js

@@ -135,2 +129,5 @@ ```

You can, for whatever strange reason, use the ReconnectingWebSocket that underlies
AwesomeWebSocket ( AwesomeWebSocket is way more awesome tho ).
```html

@@ -141,2 +138,4 @@ <script src="js/reconn.js"></script>

var ws = new ReconnectingWebSocket("ws://localhost:8080/socket");
// now ws will reconnect in the event that the server busts, the only problem
// is that you may lose any messages not sent to the server
</script>

@@ -148,3 +147,3 @@ ```

For hunting, the only real difference is that you need to provide a list of
For awesome, the only real difference is that you need to provide a list of
servers to connect to, if any of them choose to vanish... it'll handle that for

@@ -166,2 +165,15 @@ you.

But, maybe you only have one server or already do load balancing for your servers.
In that case, just give it a single url as a string.
```html
<script src="js/reconn.js"></script>
<script>
var AwesomeWebSocket = require("ws-additions").AwesomeWebSocket;
var testWs = new AwesomeWebSocket("ws://localhost:8085/socket");
testWs.send("this message is AWESOME!");
testWs.send({thisIs: "an object"}); // YAY!
</script>
```
Proxies have fun with Websockets. Nginx in particular has a great default that will

@@ -176,4 +188,4 @@ kill the connection if it is idle for too long. So you can opt to have these websockets

<script>
var ReconnectingWebSocket = require("ws-additions").ReconnectingWebSocket;
var ws = new ReconnectingWebSocket("ws://localhost:8080/socket")
var AwesomeWebSocket = require("ws-additions").AwesomeWebSocket;
var ws = new AwesomeWebSocket("ws://localhost:8080/socket")
ws.onopen = function() {

@@ -180,0 +192,0 @@ // this sets up the keep alive

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc