# node-type-chat

> node chat in cli

Latest version **1.1.4** (published 2018-05-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-type-chat
pnpm add node-type-chat
yarn add node-type-chat
bun add node-type-chat
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2018-05-01 |
| First published | 2018-03-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 46.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Stig T. Hansen |
| Maintainers | stigcq |

## Links

- npm: https://www.npmjs.com/package/node-type-chat
- npm.io page: https://npm.io/package/node-type-chat

## Dependencies (4)

- [md5](https://npm.io/package/md5.md) ^2.2.1
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [request](https://npm.io/package/request.md) ^2.85.0
- [string.prototype.startswith](https://npm.io/package/string.prototype.startswith.md) ^0.2.0

## Recent versions

- 1.1.4 (latest) — 2018-05-01
- 1.1.3 — 2018-05-01
- 1.1.2 — 2018-05-01
- 1.1.1 — 2018-05-01
- 1.1.0 — 2018-05-01
- 1.0.9 — 2018-05-01
- 1.0.8 — 2018-05-01
- 1.0.7 — 2018-05-01
- 1.0.6 — 2018-05-01
- 1.0.5 — 2018-05-01
- 1.0.4 — 2018-05-01
- 1.0.3 — 2018-03-23
- 1.0.2 — 2018-03-23
- 1.0.1 — 2018-03-22

## README

# Node Type Chat

A simple test app making a p2p chat with node.js and typescript with chat in CLI.


## Getting started
- Clone or download the repository

- Install dependencies
```
cd <project_name>
npm install
```

- Build
```
npm build
```

- Run
```
npm start
```

## How to use

1. When starting a peer first input a port number this peer will listen on. 
```
port 1200
```
2. Input a chatname for this peer
```
name JoeDoe
```
3. Then connect to network again by specifying ip andport to connect to. For first peer, choose to connect to itself (no others to connect to yet)
```
connect 127.0.0.1 1200
```
4. For second peer do the same, but when connecting choose the ip and port of first peer
```
port 1300
name IamSecondPeer
connect 127.0.0.1 1200
```
5. For third or more peer(s) choose any ip and port of an existing peer.

## How it works

Each peer functions both as a server and a client. A server/peer then offers methods which other peers can call:
* Checkin to network for first time
* Notify of new (chat) message
* Notify of new peer(s)
* Getting list of peers this peer has
* Notify of peer changed (chat) name

The peer itself offers these methods, and also use them from other peers


## Next up

Make an index.js which exports the functions so can be used as a module. The CLI interface should be possible to build with this module. Which also means some of the current output, like a message, shouldnt be outputted in the module, so I guess incoming messages or other stuff needs some listener interface, where the module user is notified and can react upon those events.

---
_Source: https://npm.io/package/node-type-chat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
