wspromisify
Advanced tools
Comparing version 0.0.501 to 0.0.502
@@ -52,3 +52,3 @@ { | ||
], | ||
"license": "ISC", | ||
"license": "MIT", | ||
"main": "dist/ws.js", | ||
@@ -68,3 +68,3 @@ "module": "dist/ws.esm.js", | ||
}, | ||
"version": "0.0.501", | ||
"version": "0.0.502", | ||
"devDependencies": { | ||
@@ -71,0 +71,0 @@ "@types/node": "^8.0.58", |
# WebsocketPromisify | ||
Makes websocket's API just like REST with Promise-like API, with native Promises. | ||
Has yummies and very lightweight! | ||
// If you detected some bug or so, please, fill an issue. | ||
// Large data support, streams and different server-side implementations are coming. | ||
@@ -13,2 +15,3 @@ | ||
- Automatically reconnects. | ||
- You can use the WebSocket (or your ws-like implementation) further in other stuff (socket property). | ||
- Any id and data keys to negotiate with your back-end. | ||
@@ -23,3 +26,10 @@ - Lazy connect: connects only if something sent, then send all of them! | ||
How it on Server Side ? | ||
``` | ||
1. Serialized JSON is sent by this lib = {id: 'generated_id', data: your data} | ||
2. Some Server processing... | ||
3. Serialized JSON is sent back by the Server = {id: 'the same generated_id', data: feedback data} | ||
``` | ||
Default constructor config is | ||
@@ -55,2 +65,9 @@ ```javascript | ||
Fields/Props: | ||
```javascript | ||
// read-only, returns WebSocket (or so) instance to use with other stuff. | ||
socket | ||
``` | ||
Methods: | ||
@@ -61,3 +78,5 @@ ```javascript | ||
send(message), | ||
on(event_name, handler, predicate), | ||
// .addEventListener with optional predicate. | ||
on(event_name, handler, predicate = (WebSocketEvent) => true), | ||
// Closes the connection and free up memory. | ||
close() | ||
@@ -64,0 +83,0 @@ |
@@ -142,2 +142,6 @@ | ||
public get socket() { | ||
return this.ws | ||
} | ||
public on(event_name, handler, predicate) { | ||
@@ -144,0 +148,0 @@ return add_event(this.ws, event_name, event => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
39597
861
114
0