Show HN: P2p IRC-inspired browser chat on WebTorrent(chr15m.github.io)
chr15m.github.io
Show HN: P2p IRC-inspired browser chat on WebTorrent
https://chr15m.github.io/dirc/#hn
17 comments
When you join a room the room name is hashed and you join a WebTorrent swarm based on that hash. So it's a collection of WebRTC peers who are connected to eachother based upon the shared hash of the room name. Not every peer is connected to every other peer.
So "when a new room is created, this has to be broadcast to all users" is not quite right. A new swarm is created when a user joins a room-hash for the first time and anybody who joins that same room-hash will be introduced to the same swarm. People who have not joined the room-hash will not be part of the p2p swarm.
Currently the hash-based WebRTC signalling that WebTorrent does to introduce peers is quite centralized but the actual communication channels are decentralized. The communication layer is implemented as a WebTorrent "extension protocol" extension. This is the same model dreamtime: https://github.com/chr15m/dreamtime
You are correct that every chat line is broadcast to everyone in the same swarm. In fact, every message is re-broadcast multiple times redundantly by every peer who receives it for the first time, because the WebRTC swarm can be fragmented. Not every peer can directly see every other peer so we must re-broadcast everything to make sure everyone sees each line.
So basically for each room you have a set of peers (browsers) connected together loosely with WebRTC data links and messages between them are sent multiple times redundantly.
Thank you very much for your interest and for trying it out.
So "when a new room is created, this has to be broadcast to all users" is not quite right. A new swarm is created when a user joins a room-hash for the first time and anybody who joins that same room-hash will be introduced to the same swarm. People who have not joined the room-hash will not be part of the p2p swarm.
Currently the hash-based WebRTC signalling that WebTorrent does to introduce peers is quite centralized but the actual communication channels are decentralized. The communication layer is implemented as a WebTorrent "extension protocol" extension. This is the same model dreamtime: https://github.com/chr15m/dreamtime
You are correct that every chat line is broadcast to everyone in the same swarm. In fact, every message is re-broadcast multiple times redundantly by every peer who receives it for the first time, because the WebRTC swarm can be fragmented. Not every peer can directly see every other peer so we must re-broadcast everything to make sure everyone sees each line.
So basically for each room you have a set of peers (browsers) connected together loosely with WebRTC data links and messages between them are sent multiple times redundantly.
Thank you very much for your interest and for trying it out.
Doesn't seem to work on Firefox 61.0.2 on Mac OS.
I can send message on Chromium but the chatroom seem empty. EDIT: Work on Chromium :)
I can send message on Chromium but the chatroom seem empty. EDIT: Work on Chromium :)
Waiting for other participants...
On Firefox 61.0.2 Firefox can’t establish a connection to the server at wss://tracker.fastcast.nz/. app.js:15:233483
ICE failed, add a TURN server and see about:webrtc for more detailsThe WebRTC signalling can take a long time (I've seen up to 2 minutes) because your browser has to find a way that other browsers can tunnel in to your network. Once you're connected messages seem to go through fairly quickly.
The fastcast.nz error is because that signalling server is down and has been for a while but you can safely ignore it.
The "ICE failed" error might be because you are behind a very restrictive firewall.
Thanks for trying it out!
The fastcast.nz error is because that signalling server is down and has been for a while but you can safely ignore it.
The "ICE failed" error might be because you are behind a very restrictive firewall.
Thanks for trying it out!
[deleted]
I never found any p2p app with similar user experience as WhatsApp.
All people on this site brag of p2p and their technical prowness, yet no one has managed to build a killer p2p chat app. Disgusting!
Probably, they are still debating what programing language to use.
All people on this site brag of p2p and their technical prowness, yet no one has managed to build a killer p2p chat app. Disgusting!
Probably, they are still debating what programing language to use.
I find WhatsApp user experience lacking and I wouldn't use it if my friends and contacts weren't all there.
It's decent platform for simple sentences and trading emojis/memes I guess.
It's decent platform for simple sentences and trading emojis/memes I guess.
Thanks for your feedback! I agree, WhatsApp is an amazing piece of software with a great user interface & UX.
There are significant computer science challenges when building peer-to-peer software that are much easier to solve when building a centralized system. This may be the reason that people seem to "brag" when they create something p2p - because it is difficult to do - and it may also be the reason why there has not been in your opinion "a killer p2p chat app" yet.
One great thing about WebTorrent is that it makes building p2p software for the web much easier. They have done a great job!
There are significant computer science challenges when building peer-to-peer software that are much easier to solve when building a centralized system. This may be the reason that people seem to "brag" when they create something p2p - because it is difficult to do - and it may also be the reason why there has not been in your opinion "a killer p2p chat app" yet.
One great thing about WebTorrent is that it makes building p2p software for the web much easier. They have done a great job!
Maybe because WhatsApp has billions to make sure everything works?
Even the non-p2p open source apps are less polished.
So really it has nothing to do with p2p at all.
Even the non-p2p open source apps are less polished.
So really it has nothing to do with p2p at all.
Have you tried Matrix? https://matrix.org/
Matrix is a great project! I believe it uses a federated model which means that it relies on people donating their servers and bandwidth and messages pass through those federated servers rather than directly between peers as with WebRTC.
Presumably, when a new room is created, this has to be broadcast to all users.
Also, i guess every chat line is kind of broadcast to everyone in the room. So how do announce a new line is available?
Many thanks.