Me on Shibuya crossing in Tokyo while I was working on my startup Mangaido.com

Very simple js p2p serverless chat on WebRTC

Michał Wrzosek
Nov 3 · 1 min read

I recently wanted to check if it’s possible to create a simple js chat with no servers in-between, so that you can directly talk with someone else via secure channel.

I found that some browsers support WebRTC. It wasn’t clear for me at the beginning how to deal with it but eventually I was able to establish p2p connection with my friends in different networks. There is still a need for STUN/TURN servers to establish connection but as far as I know it’s secure.

Currently demo chat works in Firefox. I had some issues with STUN servers in Chrome. I will gradually work on improving that thing. I encourage you to try out your own builds on WebRTC :)

The idea is that HOST get a connection code. HOST send to SLAVE his code somehow (through some other chat for example). Once the HOST paste code from SLAVE, p2p connection starts and they can talk, wow :D

You can find out source code and demo app here:
https://github.com/michal-wrzosek/p2p-chat

Michał Wrzosek

Written by

Full Stack Web Developer currently working @ Valassis Digital in Hamburg, Germany. Currently also working on my side project annumi.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade