# Discourse はサーバーから新しい投稿をクライアントにどのように通知しますか？

**URL:** https://meta.discourse.org/t/how-does-discourse-update-the-client-on-new-posts-from-the-server/109147
**Category:** Development
**Created:** [2019 年 2 月 14 日午後 1:43 UTC](https://meta.discourse.org/t/how-does-discourse-update-the-client-on-new-posts-from-the-server/109147 "2019-02-14T13:43:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Watercolor\_Games](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watercolor_games/32/131248_2.png) [@Watercolor\_Games](https://meta.discourse.org/u/Watercolor_Games)
#### Post date: [2019 年 2 月 14 日午後 1:43 UTC](https://meta.discourse.org/t/how-does-discourse-update-the-client-on-new-posts-from-the-server/109147/1 "2019-02-14T13:43:59Z")

</div>

Hey guys. My friend Declan and I were chatting on our forum’s Babble chat and we got curious how the chat plugin updates clients when a new message is sent in chat. I said “It probably uses the same code behind-the-scenes that Discourse uses to tell you ‘hey, there is a new/unread post’ without needing to refresh the page.”

First of all, am I wrong to say that? If so, how does Babble propagate messages across clients? And how does Discourse send those sorts of “new post” notifications out without refreshing? Declan did some inspection out of curiosity and didn’t see any sort of websockets going to the server.

My idea is that Discourse uses something similar to web sockets but doesn’t actually use true websockets. Like its own implementation. Either that or it uses something like SignalR in the [ASP.NET](http://ASP.NET) world. What’s really going on behind the scenes? I’m really interested in those sorts of things and I’m really curious now.

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [2019 年 2 月 14 日午後 2:12 UTC](https://meta.discourse.org/t/how-does-discourse-update-the-client-on-new-posts-from-the-server/109147/2 "2019-02-14T14:12:36Z")

</div>

I’ve not looked at Babble, but I’m assuming it uses the same mechanism the rest of Discourse uses:

[https://github.com/SamSaffron/message\_bus](https://github.com/SamSaffron/message_bus)

It’s a process or subscribing to an endpoint on the front-end and pushing updated data to said endpoint from the back-end. You can see this process if you do a search for `MessageBus` on the Discourse repo.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2019 年 2 月 15 日午前 12:57 UTC](https://meta.discourse.org/t/how-does-discourse-update-the-client-on-new-posts-from-the-server/109147/3 "2019-02-15T00:57:41Z")

</div>

See also:

> [@How discourse stays online (Message Bus, Faye, Long Polling)](https://meta.discourse.org/t/how-discourse-stays-online-message-bus-faye-long-polling/3238):
>
> Hi, sorry for bad English. I looked at source, but it’s hard to read and understand in big project. But as i understood Discourse using own implementation of communication over (Long polling (only(?))) to represent most actual data to users with MessageBus, why? Why were not used Faye?
