Skip to content

hypercore + chat

Notifications You must be signed in to change notification settings

e-e-e/hyperchat

Repository files navigation

Hyperchat

An experiment with using hypercore to share and record chat histories.

install

There are two options.

1. Globally

Install globally to use from the command line as a chat client:

npm install -g @e-e-e/hyperchat hyperchat # you will be promped to add a username? What is your name? ... # this will create a hypercore file in your home directory for this name# from the chat interface you can enter any of the following commands? >>> # :h or :help - prints out the comments the chat cli accepts# :w or :whoami - logs out your address# :c [key] or :connect [key] - listens to conversation at key# :d [key] or :disconnect [key] - stops listnening to conversation at key# :q or :quit [key] - stops sharing and kills all connections

2. Package

Install and build your own chat app on top of hyperchat

npm install @e-e-e/hyperchat --save

and import in your project;

varhyperchat=require('@e-e-e/hyperchat')varchat=newHyperchat('username')// you can listen to chat eventschat.on('ready',()=>console.log(chat.name,'now available on public key:',chat.key))chat.on('connection',()=>console.log('i am connected to someone'))chat.on('listening',data=>console.log('i am listening to',data.key))chat.on('disconnecting',key=>console.log('disconnecting from',key))chat.on('disconnected',key=>console.log('disconnected from',key))chat.on('destroyed',()=>console.log('Hyperchat is destroyed'))chat.on('started',data=>console.log(data.name,'joined conversation'))chat.on('ended',data=>console.log(data.name,'exited conversation'))chat.on('heard',data=>console.log(data.name,'heard',data.who,'-',data.index))chat.on('message',data=>console.log(`${data.name}:`,data.message))// connect to multiple other clientschat.add('some-public-key')chat.add('some-other-public-key')// disconnect from other clientschat.remove('some-public-key')// and chat to any client who is also connected to youchat.chat('hello world')

config

At the moment there are no config options exposed. Chats are by default stored at the users home: ~/hyperchats

About

hypercore + chat

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published