From da2c3c3b11062bf16e4e6380b37c701cde7a3f82 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 30 Aug 2020 23:02:09 +0200 Subject: [PATCH 01/11] [MOD] bump version to 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7557163..fd09c56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rpc-websocketserver", - "version": "1.0.0", + "version": "1.0.1", "main": "dist/index.js", "scripts": { "lint": "eslint --ext .ts --quiet --fix ./", From 488aacadd178264cc0426796a0a79a9d5f8728fb Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 08:55:55 +0200 Subject: [PATCH 02/11] [ADD] yarn error log to npmignore --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index 1474782..d7022b2 100644 --- a/.npmignore +++ b/.npmignore @@ -4,6 +4,7 @@ .prettierrc.js /coverage tsconfig.json +yarn-error.log yarn.lock jest.config.js src From 72d676e853ea561e6484e842c3ca41801eeb0440 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 08:56:30 +0200 Subject: [PATCH 03/11] [FIX] typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d750654..f386eb8 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Add experimental decorators and emit metadata to your `tsconfig.json` ## Usage example -### Create a namespaces for your rpc +### Create namespaces for your rpc ```typescript import { WebSocketServer, register, param } from 'rpc-websocketserver'; From a4ccc5e54a4771aa666abe046980aaae956f2a3b Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 10:58:16 +0200 Subject: [PATCH 04/11] [ADD] package description, package tags, installation instructions of peer dependencies in readme --- README.md | 8 ++++---- package.json | 21 +++++++++++++++++++-- yarn.lock | 5 ----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f386eb8..f40bad1 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ Wraps the popular [ws](https://github.com/websockets/ws) lib. ## Table of contents ## Installing -With yarn +With yarn (incl. peer dependencies) ```bash -yarn add rpc-websocketserver +yarn add rpc-websocketserver ws ``` -With npm +With npm (incl. peer dependencies) ``` -npm install rpc-websocketserver +npm install rpc-websocketserver ws ``` Add experimental decorators and emit metadata to your `tsconfig.json` ```json diff --git a/package.json b/package.json index fd09c56..e436f8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,21 @@ { "name": "rpc-websocketserver", "version": "1.0.1", + "description": "Simple rpc websocket server, wrapping the very popular 'ws' library. Register your RPCs with convenient decorators.", + "keywords": [ + "RPC", + "json-rpc2", + "websocket-server", + "rpc-websocketserver", + "server", + "ws", + "typescript", + "ts", + "decorator", + "WebSocket", + "WebSockets", + "real-time" + ], "main": "dist/index.js", "scripts": { "lint": "eslint --ext .ts --quiet --fix ./", @@ -10,8 +25,10 @@ }, "license": "MIT", "dependencies": { - "reflect-metadata": "^0.1.13", - "ws": "^7.3.0" + "reflect-metadata": "^0.1.13" + }, + "peerDependencies": { + "ws": ">= 7.0.0 < 8" }, "devDependencies": { "@types/express": "^4.17.6", diff --git a/yarn.lock b/yarn.lock index bce30c4..cfa5a41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4811,11 +4811,6 @@ ws@^7.2.3: resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8" integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA== -ws@^7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd" - integrity sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w== - xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" From 5952283fe5fec4360af9ae492e9eb961c42c34ad Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 13:08:57 +0200 Subject: [PATCH 05/11] [MOD] change main file in package json from dist/index.js to index.js --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e436f8f..d9ca073 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "WebSockets", "real-time" ], - "main": "dist/index.js", + "main": "index.js", "scripts": { "lint": "eslint --ext .ts --quiet --fix ./", "clean": "rm -rf dist && mkdir dist", From 2535ac42948787f3b51957bc8da5f06e318037b7 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 14:51:48 +0200 Subject: [PATCH 06/11] [MOD] CHANGELOG and README --- CHANGELOG.md | 13 +++++++++++++ README.md | 33 ++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f10832..44945bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## Added + +## Changed +- changed ws from dependency to peer dependency (incl. doc) + +## Removed + +## [1.0.1] - 2020-08-30 +## Added +- npmignore file + +## Removed +- unnecessary files from dist ## [1.0.0] - 2020-08-30 ### Added diff --git a/README.md b/README.md index f40bad1..aeec72b 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,20 @@ A simple and extensively documented typescript focused lib, to implement/prototy Wraps the popular [ws](https://github.com/websockets/ws) lib. -**Note**: This is a backend focused library and does therefore not work in the browser. +**Note**: This is a backend focused library and therefore does not work in the browser. ## Table of contents +- [Installing](#installing) +- [Features, limitations and possible features to be added](#features-limitations-and-possible-features-to-be-added) + - [Features](#this-lib-offers-the-following-out-of-the-box) + - [Limitations](#this-lib-does-not-offer-the-following) + - [Possible features](#possible-features-to-be-added-in-the-future) +- [Usage examples](#usage-examples) + - [Create namespaces for your rpc](#create-namespaces-for-your-rpc) + - [Server](#server) +- [Changelog](#changelog) +- [Contributing](#contributing) +- [License](#license) ## Installing With yarn (incl. peer dependencies) @@ -28,26 +39,26 @@ Add experimental decorators and emit metadata to your `tsconfig.json` ... } ``` -## Perks, limitations and future prospects +## Features, limitations and possible features to be added ### This lib offers the following out of the box: * Extensive documentation for ease of development +* Retains all functionality of the [ws](https://github.com/websockets/ws) lib * RPC namespace creation -* [JSON RPC 2](https://www.jsonrpc.org/specification) conform message handler -* Simple message handler +* [JSON RPC 2](https://www.jsonrpc.org/specification) conform message handler (incl. errors, responses and the like) +* Simple message handler (super simplistic message handler) * Easily readable and maintainable registration of namespace methods with decorators -* Convenience method to broadcast messages to clients +* Convenience methods to interact with clients (e.g. broadcast messages to all clients). *You are also able to reimplement all ws listeners and convenience methods if you wish* * Defined interfaces to implement your own custom message handlers -* Retains all functionality of the [ws](https://github.com/websockets/ws) lib ### This lib does **NOT** offer the following: * Batch request handling -* Parameter typechecking of rpc methods +* Runtime parameter typechecking on remote procedure call ### Possible features to be added in the future: * [Swagger](https://swagger.io/) like documentation generation with [OpenRPC](https://open-rpc.org/) as model * Protected methods (require authentication before calling rpc) -## Usage example +## Usage examples ### Create namespaces for your rpc ```typescript @@ -89,7 +100,7 @@ class NamespaceB extends WebSocketServer { ``` ### Server -Set up your ws server similar to the way you would in the [ws example](https://github.com/websockets/ws/blob/master/README.md#multiple-servers-sharing-a-single-https-server) and add your own namespaces +Set up your ws server similar like you would in the [ws example](https://github.com/websockets/ws/blob/master/README.md#multiple-servers-sharing-a-single-https-server) and add your own namespaces ```typescript import express from 'express'; import http from 'http'; @@ -103,6 +114,7 @@ const server = http.createServer(app); // pass message handler instances and WebSocket.ServerOptions to the respective namespaces const namespaceA = new RPCNamespaceA(new SimpleMessageHandler(), { noServer: true }); +// use different message handlers for different namespaces const namespaceB = new RPCNamespaceB(new JSONRPC2MessageHandler(), { noServer: true }); @@ -129,6 +141,9 @@ server.listen(10001, '0.0.0.0', 1024, () => { That's it! +## Changelog +[Changelog](https://github.com/JohnBra/rpc-websocketserver/blob/master/CHANGELOG.md) + ## Contributing Feel free to give feedback through issues or open pull requests with improvements. From 81482c381bcdb7c12001b309ca05221170daf9bf Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 15:05:08 +0200 Subject: [PATCH 07/11] [MOD] CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44945bb..1c91491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## Added +- npm package description +- npm package tags ## Changed - changed ws from dependency to peer dependency (incl. doc) From f112827886d31b4c462ac8c587618868f5bdad71 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 15:28:39 +0200 Subject: [PATCH 08/11] [ADD] badges to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index aeec72b..1bb463f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # rpc-websocketserver - A Node.js library +[![Version npm](https://img.shields.io/npm/v/rpc-websocketserver.svg?logo=npm)](https://www.npmjs.com/package/rpc-websocketserver) +![build](https://github.com/JohnBra/rpc-websocketserver/workflows/build/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/JohnBra/rpc-websocketserver/badge.svg?branch=master)](https://coveralls.io/github/JohnBra/rpc-websocketserver?branch=master) + A simple and extensively documented typescript focused lib, to implement/prototype rpc websocket server applications with convenient decorators. Wraps the popular [ws](https://github.com/websockets/ws) lib. From 9747ec9019d519d1f70cdc26d5a895a5f9774fc0 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 20:44:01 +0200 Subject: [PATCH 09/11] [MOD] bump version to v1.0.2 --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c91491..82839be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.0.2] - 2020-08-31 ## Added - npm package description - npm package tags diff --git a/package.json b/package.json index d9ca073..61936ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rpc-websocketserver", - "version": "1.0.1", + "version": "1.0.2", "description": "Simple rpc websocket server, wrapping the very popular 'ws' library. Register your RPCs with convenient decorators.", "keywords": [ "RPC", From 240368cf15cbb896ec9ca0def1889e0ffcfc7097 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 20:45:27 +0200 Subject: [PATCH 10/11] [DEL] cleanup --- CHANGELOG.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82839be..1344ee0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.0.2] - 2020-08-31 -## Added +### Added - npm package description - npm package tags -## Changed +### Changed - changed ws from dependency to peer dependency (incl. doc) -## Removed - ## [1.0.1] - 2020-08-30 ## Added - npmignore file From f38703a95ca1d4142d3e6709482814c6c5c13aaa Mon Sep 17 00:00:00 2001 From: John Date: Mon, 31 Aug 2020 20:45:48 +0200 Subject: [PATCH 11/11] [DEL] cleanup --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1344ee0..dd94931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,10 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - changed ws from dependency to peer dependency (incl. doc) ## [1.0.1] - 2020-08-30 -## Added +### Added - npmignore file -## Removed +### Removed - unnecessary files from dist ## [1.0.0] - 2020-08-30