News for hackers. Stuff that matters.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by mynewtb on Monday January 22, 2018 @06:47AM (#16203668)
How does something like this scale? The more hashes there are in IPFS the more latency, or am I misunderstanding?
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:45AM (#16205198)
No, there is no global database. You just share hashes that you know about, so no matter how many hashes there is, IPFS will still be the same speed.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Sunday January 21, 2018 @07:26PM (#16200948)
Hello, I made this! Please try it out and tell me what you think. Annotated source is public here: https://ipfs.io/ipfs/QmVUvLMxTEaVBpiQBiBBdnv7ZTwt7pv8BxNhpPC...
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by geoah on Monday January 22, 2018 @06:42AM (#16203644)
An insane amount of `NullPointerException` messages are ruining the fun! :D
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by xiconfjs on Monday January 22, 2018 @07:37AM (#16203897)
My Browser crashed after a few minutes...FF57 @ Ubuntu 16.04 :(
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by creichenbach on Monday January 22, 2018 @09:45AM (#16204668)
Same here.

Every message (including sign-on/-off) creates a node in the DOM tree that never gets removed. That's about 15-20 per second at the moment, so this might cause the eventual crash.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:44AM (#16205190)
Seems to be a bug with js-ipfs or just a lot of DOM nodes... Not sure how to fix.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by rutierut on Monday January 22, 2018 @07:41AM (#16203921)
Crashed my browser too FF57 @ Mac OS 10.13
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by LoSboccacc on Monday January 22, 2018 @08:55AM (#16204309)
very interesting. seems to be handling the load exceptionally well, even if the system messages are interfering right now. latency is quite good to!

there's something I don't understand from skimming the docs: if I want to use IPFS for a project of mine, do I have to deploy a IPFS backend or there's a default I can use? it's said to be peer-to-peer so unless the peer are shared across all projects small implementation may have issues to keep availability.

edit: figured out there's a public gateway and one can also set up a private swarm. sweet!

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:46AM (#16205209)
Yes, system messages got in the way. Try this version without them: https://ipfs.io/ipfs/QmbZVv9q52znhF9wN6GVi55EJQYq2BR6oeTgzVn...

If you want to use IPFS, you can either import IPFS as a library (which this application does, everything is P2P in the browser, by using js-ipfs and including it in the application, you can see it in the annotated source here: https://ipfs.io/ipfs/QmbZVv9q52znhF9wN6GVi55EJQYq2BR6oeTgzVn...) or you can connect to a gateway.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by StavrosK on Tuesday January 23, 2018 @06:02AM (#16212564)
Essentially, you'd just run the IPFS node and add files to it. Gateways won't store your files for long.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:35AM (#16205103)
Hello again everyone! Seems like a lot more people joined the chat and the system messages are kind of getting into the way. I've released a updated version here: https://ipfs.io/ipfs/QmbZVv9q52znhF9wN6GVi55EJQYq2BR6oeTgzVn...

Please try that version instead! If moderators see this message, please update the link!

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by Rhapso on Monday January 22, 2018 @10:55AM (#16205286)
+100 awesome for the annotated source. A lot of these demos get released as minified JS which makes it kinda useless to use them as a guide or hack on them.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @11:02AM (#16205365)
Thanks! Exactly what I was thinking and it's much nicer when you can actually learn from the examples!

The annotated source Rhapso is talking about is here: https://ipfs.io/ipfs/QmVUvLMxTEaVBpiQBiBBdnv7ZTwt7pv8BxNhpPC...

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by fiatjaf on Monday January 22, 2018 @09:23PM (#16210390)
Here we see the problem with using IPFS for, let's say, "dynamic" applications.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Tuesday January 23, 2018 @04:48AM (#16212216)
Would have been easy to fix, if this wasn't a demo.

Either you use IPNS which are pointers to other data on IPFS. Or you can use DNS to point to IPFS hashes. The results are the same, you end up with a address that can be updated.

For this example I didin't use it, as it's just a silly little example.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by DennisP on Monday January 22, 2018 @10:29AM (#16205050)
Rather than using a discovery server, couldn't you throw in the web3 library and use Ethereum for that purpose? You could keep the discovery server as backup for people not connected to Ethereum nodes, but for those that are you'd be fully decentralized. To keep things cheap you could use Ethereum's event logging rather than actually storing data on chain.

In any case, this is great, I've been looking for something like this.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:48AM (#16205237)
Not sure how that would work. You would have to make some transaction on the Ethereum network for other peers to discover you, correct? That kind of makes the barrier to entry a lot harder.

On desktop, it's possible to use mDNS et al, we need something similar for browsers.

Please tell me more how I could use Ethereum for discovery of other peers though, sounds interesting.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by DennisP on Monday January 22, 2018 @11:07AM (#16205411)
Yes, so it'd only work for people running things like the Metamask browser plugin. It'd be nifty because it'd be fully decentralized, but for now, using the discovery server as backup would keep it working for everyone else.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by fiatjaf on Monday January 22, 2018 @09:19PM (#16210363)
So you write a chat message, store it on IPFS and then send the hash to the other party? Why don't you just send the message through whatever means you're sending the hash?

This kind of app doesn't seem like a good fit for the whole IPFS idea. The same applies to Orbit.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Tuesday January 23, 2018 @04:49AM (#16212224)
No, you clearly didn't read the annotated source that is linked both from the application and various comments here on this submission.

The chat messages are being sent directly to the other party.

Why is that? I think this app fits very good with IPFS. Same applies to Orbit.

Re:Show HN: Peer-to-peer chat example built with JavaScript ... by fiatjaf on Wednesday January 24, 2018 @04:27PM (#16226482)
So it doesn't use IPFS at all.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by tlrobinson on Monday January 22, 2018 @08:16AM (#16204089)
It seems like it's repeating old messages over and over, then eventually crashing.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by sharemywin on Monday January 22, 2018 @08:26AM (#16204142)
mine didn't crash yet, but the repeating of messages was kind of annoying.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by dranoel0226 on Monday January 22, 2018 @05:25AM (#16203324)
this is really cool, thanks! do you happen to know if / when this will work without a discovery server?
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by jaynagpaul on Monday January 22, 2018 @06:45AM (#16203656)
You can run an ipfs node locally if you wish
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by tn_ on Monday January 22, 2018 @09:21AM (#16204479)
Just one tiny suggestion, let users create their display name. The hashed names make it a bit unreadable.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Monday January 22, 2018 @10:47AM (#16205215)
Already possible, check out the input in the bottom left. Not very obvious, but it's there already.
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by QML on Monday January 22, 2018 @03:08PM (#16207448)
IPFS is a protocol for file-sharing, not for file-hosting, right?
Re:Show HN: Peer-to-peer chat example built with JavaScript ... by p2pchatter on Tuesday January 23, 2018 @04:48AM (#16212219)
What is the difference? You can host files on IPFS just as you can share files.