https://github.com/danielrs/node-chatty
A simple node module for chatting through IPv6 (Educational purposes)
https://github.com/danielrs/node-chatty
Last synced: about 1 year ago
JSON representation
A simple node module for chatting through IPv6 (Educational purposes)
- Host: GitHub
- URL: https://github.com/danielrs/node-chatty
- Owner: danielrs
- License: mit
- Created: 2015-06-22T16:04:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-11T19:47:45.000Z (over 10 years ago)
- Last Synced: 2025-04-12T06:59:46.090Z (about 1 year ago)
- Language: JavaScript
- Size: 72.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## How to initialize a server and a client?
You can try this on node's REPL:
```javascript
chat = require('./lib/Chat.js');
```
And depending on the machine you are using:
#### Server
```javascript
...
server = new chat.Server();
...
```
#### Client
```javascript
...
client = new chat.Client();
client.findServer();
client.connect();
...
```
**NOTE**: You cannot run a server *and* a client on the same machine.
## How to send messages?
On the client you can use the following functions:
| Function | Description |
| --- | --- |
| `sendMessage(uuid, message)` | Send a message to client with the specified uuid |
| `sendGroupMessage(uuid, message)` | Send a message to the specified group |
| `getMessages()` | Gets all received messages |
| `createGroup(name)` | Creates a group with given name |
| `joinGroup(uuid)` | Tries to join the group with the given uuid |
| `leaveGroup(uuid)` | Leaves group with given uuid |
| `getGroups()` | Get a list of available groups |