# Websocket events recipients for create\_channel and user\_added

**URL:** <https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573>\
**Category:** Troubleshooting\
**Created:** [January 25, 2019, 12:33pm UTC](https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573 "2019-01-25T12:33:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aocenas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/aocenas/32/2645_2.png) [@aocenas](https://forum.mattermost.com/u/aocenas)\
**Post date:** [January 25, 2019, 12:33pm UTC](https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573/1 "2019-01-25T12:33:47Z")

</div>

Not sure if this is a bug or intentional and I should file a feature request. We use mattermost-server with custom frontend and when user creates channel, we add all team members to it and want to refresh the UI for the others so they see the new channel automatically. The issue is that the websocket events are sent to recipients which do not benefit much from it.

For channel\_created event the recipient is the user who created the channel [https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L156](https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L156). I would expect this to go to the team under which the channel was created to show a notification about new channel to all the team members.

Event user\_added on the other hand goes only to the channel in question [https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L831](https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L831) but not to the user being added to the channel, so again there is no notification that the user added to channel can act upon.

So is this expected behaviour? Are there some other events I could use to reliably notify user about new channel in his team or that he was added to channel?

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [January 25, 2019, 5:34pm UTC](https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573/2 "2019-01-25T17:34:56Z")

</div>

Hi @aocenas,

The first case (channel created) would be a feature request.

The second case (user added) should work. What Mattermost server version are you currently using?

---

<div class="post-metadata">

**Author:** ![aocenas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/aocenas/32/2645_2.png) [@aocenas](https://forum.mattermost.com/u/aocenas)\
**Post date:** [January 28, 2019, 9:19am UTC](https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573/3 "2019-01-28T09:19:21Z")

</div>

Hi @amy.blais

I tried it with 5.5.1 version and also latest master. The relevant code for sending user\_added is here [https://github.com/mattermost/mattermost-server/blame/ce2c7110d3db836790f90fc63968b68f14a9f516/app/channel.go#L831](https://github.com/mattermost/mattermost-server/blame/ce2c7110d3db836790f90fc63968b68f14a9f516/app/channel.go#L831) and based on blame it seems it did not change in 2 years and as you can see only ‘channel.Id’ is filled there for the event broadcast. I did not find any other usage of the WEBSOCKET\_EVENT\_USER\_ADDED event in the code. Is it possible there is some other event I should be looking for?

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [January 30, 2019, 12:06am UTC](https://forum.mattermost.com/t/websocket-events-recipients-for-create-channel-and-user-added/6573/4 "2019-01-30T00:06:45Z")

</div>

Hi @aocenas,

A response from one of our community members: The added user should see a post with type `model.POST_ADD_TO_CHANNEL` - see [https://github.com/mattermost/mattermost-server/blob/v5.7.0/app/channel.go#L1375](https://github.com/mattermost/mattermost-server/blob/v5.7.0/app/channel.go#L1375).
