I made a P2P Chat website, some feedbacks?


#1

Hi everyone,

I’m working on a P2P Chat website for a personal/school project.
It uses PeerJS for the P2P part and a client side only collection to store messages and notifications.

The front end isn’t that good, I’m not a front end guy so I didn’t take too much time on it.

I have a question about the methods, I don’t know how to handle method exceptions.
If I use the method callback and log the error object, the part simulating on the client still throws an exception in the browser console.

Live demo : http://p2pchat.meteor.com (doesn’t work with HTTPS because of peerjs)
Source : https://github.com/yanisIk/P2PChat

If you have any other suggestions or anything, you can submit pull requests or tell me here and I’ll gladly ‘‘review’’ and accept them :smile:


#2

Hey, looks good so far. I can create accounts, join rooms and write messages. all the rooms look empty, and when I F5 to refresh the browser, my messages are not persisting so it looks like you are not saving the data to mongo.


#3

Thanks for your feedback !
Yes the messages aren’t saved in the DB, they don’t even go through the server, they are sent directly from browser to browser via the WebRTC protocol, that’s why I named it P2P chat. Maybe I can persist them localy somewhere on the client.
The server only tracks rooms and users.


#4

ah ok, that’s cool, i didn’t get that at all. If that’s the case, maybe it’s better to have a room auto created when a user initiates a chat with another user because the room would otherwise be mostly empty. You’d also not be able to see the room’s history if you were joining afterwards (unless you synced the new user’s collection with one authoritative room history)… an interesting concept, very temporary chat indeed.


#5

I will probably add a room timeout or something like that : If a room is empty for more than 30mn, it will be deleted.
When you send a message to a user it is a private message so I don’t think it’s a good idea that other people could join their conversation.


#6

Cool project! I’m actually working on something similar. It’s nice to see more people using the webrtc. Nice work!