# Solved: Missing serverData in connection object of second participant

**URL:** <https://openvidu.discourse.group/t/solved-missing-serverdata-in-connection-object-of-second-participant/799>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [May 15, 2020, 11:52am UTC](https://openvidu.discourse.group/t/solved-missing-serverdata-in-connection-object-of-second-participant/799 "2020-05-15T11:52:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![netamity](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@netamity](https://openvidu.discourse.group/u/netamity)\
**Post date:** [May 15, 2020, 11:52am UTC](https://openvidu.discourse.group/t/solved-missing-serverdata-in-connection-object-of-second-participant/799/1 "2020-05-15T11:52:09Z")

</div>

I’m running the openvidu-js-java tutorial and made some modifications by using PHP (instead of java) to get the token session and token- all that works for the first person in the room.

When a second person joins, I get a js error  
`Unexpected token u in JSON at position 0`  
This related to the appendUserData function which uses the connection object- this part of the function  
` if (connection.nickName) { // Appending local video data`  
` clientData = connection.nickName;`  
` serverData = connection.userName;`  
` nodeId = 'main-videodata';`  
` } else {`  
` clientData = JSON.parse(connection.data.split('%/%')[0]).clientData;`  
` serverData = JSON.parse(connection.data.split('%/%')[1]).serverData;`  
` nodeId = connection.connectionId;`  
` }`  
As it’s looking not for local video data, but this line:  
`serverData = JSON.parse(connection.data.split('%/%')[1]).serverData;`  
I took a look at the connection object being passed and it looks like this:  
` Connection {session: Session, disposed: false, options: {…}, connectionId:``"con_YF0I8w1oNL", creationTime: 1589541252652, …}`  
` connectionId: "con_YF0I8w1oNL"`  
` creationTime: 1589541252652`  
` data: "{"clientData":"admin2"}"`  
` disposed: false`  
` options: {id: "con_YF0I8w1oNL", createdAt: 1589541252652, metadata:`"`{"clientData":"admin2"}", streams: Array(1)}`  
`...`

As you can see, there is no serverData element in the ‘data’ within the connection object.

As I’ve added my own session and login functionality, it’s not using SessionController.java which the docs say ‘It also stores our active video-calls and the users connected to them’. Is this the issue?

Can anyone confirm that is the issue, and if so, how I might implement it in PHP?

When setting up the token, the data needed to be passed to the server in the postdata, along with the sessionid. Because it couldn’t find this json data when trying to append it to the video frame, the whole thing was erroring out. The local video (ie. the one from your camera, didn’t need to pull this data from the servers session object, so it was fine. Hope this helps others
