diff --git a/npmextra.json b/npmextra.json index e1692c1..aa641c9 100644 --- a/npmextra.json +++ b/npmextra.json @@ -8,14 +8,26 @@ "description": "a bi-directional, multiplatform, best-effort transport", "npmPackagename": "@push.rocks/isotransport", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "bi-directional communication", + "multiplatform", + "best-effort transport", + "TypeScript", + "node.js", + "testing", + "software development", + "git", + "npm package", + "open source" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index aed9fe9..cec10b9 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,17 @@ "@pushrocks/smartenv": "^5.0.5", "@pushrocks/smartpromise": "^3.1.7", "ws": "^8.11.0" - } + }, + "keywords": [ + "bi-directional communication", + "multiplatform", + "best-effort transport", + "TypeScript", + "node.js", + "testing", + "software development", + "git", + "npm package", + "open source" + ] } \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 1e37571..f94f95b 100644 --- a/readme.md +++ b/readme.md @@ -1,37 +1,103 @@ -# @pushrocks/isotransport +# @push.rocks/isotransport a bi-directional, multiplatform, best-effort transport -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/isotransport) -* [gitlab.com (source)](https://gitlab.com/pushrocks/isotransport) -* [github.com (source mirror)](https://github.com/pushrocks/isotransport) -* [docs (typedoc)](https://pushrocks.gitlab.io/isotransport/) +## Install +To install `@push.rocks/isotransport`, use the following command in your project directory: -## Status for master +```bash +npm install @push.rocks/isotransport --save +``` -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/isotransport/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/isotransport/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/isotransport)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/isotransport)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/isotransport)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/isotransport)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/isotransport)](https://lossless.cloud) +This will fetch and install the `isotransport` package and add it as a dependency to your project's `package.json` file. ## Usage +The `@push.rocks/isotransport` module is designed as a versatile transport layer that abstracts away the complexity of bi-directional communication across different platforms. Its goal is to provide a "best effort" transport, meaning it aims to optimize communication reliability and efficiency without guaranteeing message delivery under all circumstances. -Use TypeScript for best in class intellisense +In the following sections, various aspects of using `@push.rocks/isotransport` are covered, including setting up a simple server-client connection, handling messages, and configuring the transport layer for different environments. -## Contribution +### Basic Setup +First, ensure that you are using TypeScript and have it configured in your project. `@push.rocks/isotransport` is developed with TypeScript in mind, offering type definitions out of the box for enhanced development experience. -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +#### Importing +Start by importing the necessary components from `@push.rocks/isotransport` in your TypeScript file: -For further information read the linked docs at the top of this readme. +```typescript +import { IsotransportServer, IsotransportClient } from '@push.rocks/isotransport'; +``` -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +### Setting Up a Server +To set up a server instance that listens for incoming connections, use the `IsotransportServer` class: + +```typescript +const transportServer = new IsotransportServer({ + port: 8080, // Specify the port on which the server should listen +}); + +// Start listening for connections +transportServer.listen().then(() => { + console.log('Server is listening for incoming connections...'); +}); + +// Handling client connections +transportServer.on('connection', (client) => { + console.log('Client connected:', client.id); + + client.on('message', (message) => { + console.log('Message from client:', message); + }); + + client.send('Welcome to isotransport server!'); +}); +``` + +### Setting Up a Client +Setting up a client that connects to an isotransport server is straightforward with the `IsotransportClient` class: + +```typescript +const transportClient = new IsotransportClient({ + url: 'ws://localhost:8080', // URL of the isotransport server +}); + +// Connecting to the server +transportClient.connect().then(() => { + console.log('Connected to the server.'); +}); + +// Sending a message to the server +transportClient.send('Hello, server!'); + +// Receiving messages from the server +transportClient.on('message', (message) => { + console.log('Message from server:', message); +}); +``` + +### Multiplatform Communication +`@push.rocks/isotransport` shines in scenarios where communication needs to happen across different platforms, for example, between a Node.js server and a web client. The design of isotransport abstracts the underlying transport mechanisms (like WebSockets for web clients and TCP sockets for Node.js), offering a unified API for sending and receiving messages. + +### Advanced Configuration +Isotransport provides hooks and configuration options for tweaking its behavior to fit specific use cases. For instance, you can configure retry strategies for message delivery, set custom serializers for message encoding/decoding, or integrate with custom logging solutions to monitor communication flows. + +Due to the scope of this guide, these advanced topics are not covered in detail here. However, they are well-documented in the isotransport API documentation, offering comprehensive insights into enhancing the capabilities of your transport layer. + +### Conclusion +`@push.rocks/isotransport` is a powerful tool for creating reliable, efficient, and scalable communication layers in your application. By abstracting the complexities of bi-directional multiplatform communication, it allows developers to focus on building the core features of their applications. Whether you're developing a real-time chat application, a distributed microservices architecture, or any system that requires robust communication, isotransport provides the foundational elements needed to bring your project to life. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.