New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.8 to 0.0.9

src/reconnecting-websocket.litcoffee

4

index.js

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

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

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

@@ -25,5 +25,2 @@

it's good to have the socket just pickup as if the server were never gone.
* Resending - as a consumer of a WebSocket enabled service, it'd sure be nice if
when you say ws.send('my message') that the message will go, even if the socket
isn't connected when you call 'send'.
* Hunting - given a list of hosts, connect to them and send messages to which

@@ -47,5 +44,2 @@ ever one is available, switching to another if the 'active' connection becomes

give up some of the 'raw' WebSocket interface elements.
* If you're using the ReconnectingAndResendingWebSocket you don't need access
to the full interface of the ReconnectingWebSocket (specifically `onreconnect`
and `ondatanotsent`).

@@ -67,5 +61,4 @@ ### You sure it works?

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

@@ -89,3 +82,5 @@ all to run at the same time ( hence the multiple pages ).

attribute EventHandler onclose;
attribute EventHandler onreconnect;
// ondisconnect is a convenience that is intended for testing, but in the
// spirit of transparency...
attribute EventHandler ondisconnect;
void close([Clamp] optional unsigned short code, optional DOMString reason);

@@ -95,3 +90,2 @@

attribute EventHandler onmessage;
attribute EventHandler ondatanotsent;
void send(DOMString data);

@@ -101,29 +95,12 @@ void send(Blob data);

void send(ArrayBufferView data);
```
#### What's a ReconnectingResendingWebSocket look like?
void keepAlive(int timeoutMs, DOMString message)
void keepAlive(int timeoutMs, Object message)
```
[Constructor(DOMString url)]
interface ReconnectingResendingWebSocket : EventTarget {
attribute WebSocket underlyingWs;
// networking
attribute EventHandler onopen;
attribute EventHandler onerror;
attribute EventHandler onclose;
void close([Clamp] optional unsigned short code, optional DOMString reason);
#### What's a AwesomeWebSocket look like?
// messaging
attribute EventHandler onmessage;
void send(DOMString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
```
#### What's a HuntingWebSocket look like?
```
[Constructor([DOMString url])] - ? that's not right is it ?
interface HuntingWebSocket : EventTarget {
[Constructor([DOMString url] | DOMString url)]
interface AwesomeWebSocket : EventTarget {
attribute WebSocket currSocket;

@@ -135,3 +112,2 @@

attribute EventHandler onclose;
attribute EventHandler onreconnect
void close();

@@ -141,4 +117,2 @@

attribute EventHandler onmessage;
attribute EventHandler ondatanotsent;
attribute EventHandler onsentto;
void send(DOMString data);

@@ -148,8 +122,7 @@ void send(Blob data);

void send(ArrayBufferView data);
void keepAlive(int timeoutMs, DOMString message)
void keepAlive(int timeoutMs, Object message)
```
You can consume the functionality in a couple ways, either by explicit
creation of one of these 'enhanced WebSockets' or by replacing the native
WebSocket implementation with the one of your choosing.
First of all, you'll to get the sucker into a format usable by your browser.

@@ -174,10 +147,3 @@ 'round here we like browserify.

```
-- or --
```html
<script src="js/reconn.js"></script>
<script>
var ReconnectingResendingWebSocket = require("ws-additions").ReconnectingResendingWebSocket;
var ws = new ReconnectingResendingWebSocket("ws://localhost:8080/socket");
</script>
```
With that, your `ws` will handle reconnecting for you in the event that the

@@ -193,4 +159,4 @@ server at `ws://localhost:8080/socket` disappears.

<script>
var HuntingWebSocket = require("ws-additions").HuntingWebSocket;
var testWs = new HuntingWebSocket([
var AwesomeWebSocket = require("ws-additions").AwesomeWebSocket;
var testWs = new AwesomeWebSocket([
"ws://localhost:8085/socket",

@@ -197,0 +163,0 @@ "ws://localhost:8086/socket"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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