
A real-time chat app in 23 lines of Python and 35 lines of JavaScript - kdunglas
https://github.com/dunglas/mercure/pull/32
======
stevenicr
I'd take 46 lines of python and 70 lines of javascript if we could have a
moderation panel that gives admins access to vistor ips and ability to block
names, ip subnets and cidrs.

Would be nice to finally get a replacement for the old RealChat application -
everyone seems to be building light ux apps without security. Fine for
chatting with friends or coworkers, not so great for open web deployment.

------
kbd
Should have a "Show HN:" tag.

------
sdinsn
It's a pull request that hasn't been merged yet? Why share this?

~~~
craftyguy
Not OP, but I suspect it's to either drum up interest for it and/or get more
eyes on the code in the hopes that others will review it.

------
sametmax
What's the difference mercure and the competition such as wamp.ws ?

~~~
mrastro
They address this in the README of the repo
([https://github.com/dunglas/mercure](https://github.com/dunglas/mercure))
under the "What's the Difference Between Mercure and WebSocket?" section:

> WebSocket is a low level protocol, Mercure is a high level one. Mercure
> provides convenient built-in features such as authorization, re-connection
> and state reconciliation ; while with WebSocket, you need to implement them
> yourself. Also, unlike Mercure (which is built on top of HTTP and Server-
> Sent Events), WebSocket is not designed to leverage HTTP/2.

> HTTP/2 connections are multiplexed and bidirectional by default (it was not
> the case of HTTP/1). When using Mercure over a h2 connection (recommended),
> your app can receive data through Server-Sent Events, and send data to the
> server with regular POST (or PUT/PATCH/DELETE) requests, with no overhead.

~~~
sametmax
Wamp.ws is not raw websocket, it's a high level open protocol standardized and
registered at IANA. It features rpc, pub sub, namespaces, realms and has FOSS
client implementations in python, c++, java, js, php, c#...

So my question stands.

------
snek
I was about to comment about how it might be better to use WebSockets since
SSE has a bad compatibility history, then I realized what mercure is.

