# How does one detect the publisher of an added stream?

**URL:** https://discourse.lynckia.com/t/how-does-one-detect-the-publisher-of-an-added-stream/367
**Category:** Support
**Created:** [January 19, 2017, 10:22am UTC](https://discourse.lynckia.com/t/how-does-one-detect-the-publisher-of-an-added-stream/367 "2017-01-19T10:22:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![miyagi\_goku](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@miyagi\_goku](https://discourse.lynckia.com/u/miyagi_goku)
#### Post date: [January 19, 2017, 10:22am UTC](https://discourse.lynckia.com/t/how-does-one-detect-the-publisher-of-an-added-stream/367/1 "2017-01-19T10:22:34Z")

</div>

Hi, I was experimenting with this project. Really amazing work.

How does one detect the publisher of an added stream? When creating a new token in Nuve, one must provide a `userName`. Is this `userName` available somewhere in the added stream somewhere?  
If not I suppose the publisher can send it along the stream attributes, but being client side it can pass anything really(userName/id of others).

EDIT: I have added an example to better explain my query.

example: say a room consists of 3 participants and solely sending ‘data’ (say chat message ) in the streams to one another. How can a user determine which stream belongs to which person ? I could not find this info in the streamEvent that fires when a new stream is added for a client, nor in the accompanying stream object. If I send this info(username) in the stream attributes of the publisher they could pretend to be another user in the room by simply changing this attribute information.

Is there any way to detect the publisher name/id in the Erizo added stream on the client side ? Or perhaps I am thinking about this in a wrong way. Would appreciate some thoughts.

Thanks!

---

<div class="post-metadata">

### Author: ![miyagi\_goku](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@miyagi\_goku](https://discourse.lynckia.com/u/miyagi_goku)
#### Post date: [January 24, 2017, 11:13am UTC](https://discourse.lynckia.com/t/how-does-one-detect-the-publisher-of-an-added-stream/367/2 "2017-01-24T11:13:36Z")

</div>

Anyone ?  
I suppose I could implement some methods on my app server for user verification but I want to be sure that I am not making any incorrect assumption.

---

<div class="post-metadata">

### Author: ![mkh](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.lynckia.com/mkh/32/38_2.png) [@mkh](https://discourse.lynckia.com/u/mkh)
#### Post date: [January 24, 2017, 6:21pm UTC](https://discourse.lynckia.com/t/how-does-one-detect-the-publisher-of-an-added-stream/367/3 "2017-01-24T18:21:03Z")

</div>

Hi,

You can use [stream.getAttributes()](http://lynckia.com/licode/client-api.html#getAttributes) and [stream.setAttributes()](http://lynckia.com/licode/client-api.html#setAttributes) for your purpose.
