Question: I am trying to send two calls in a peer connection and I want to differentiate them through meta\_data but I get null when I check meta\_data. How can I add meta\_data on making calls?
This my current code.

```
let cameracall = peer.call(conn.peer,ourcamera,{
    meta_data:JSON.stringify({ "type":"camera" })
});
let screencall = peer.call(conn.peer,ourscreen,{
meta_data:JSON.stringify({"type":"help"})
}); 

```

Here is a link to the documentation [peercall](https://peerjs.com/docs.html#peercall)

Answer: 
for calling a remote peer in normal way without metadata we have:

```
peer.call(remotePeerId, ourLocalStream);

```

for calling a remote peer + attaching some metadata to the call:

```
options = {metadata: {"type":"screensharing"}};
peer.call(remotePeerId, ourLocalStream, options);

```

on remote peer side, for checking metadata in received call:

```
 peer.on('call', call => {
    console.log(call.metadata.type);
    call.answer();
    call.on('stream', stream => {
       // somthing to do
    });
 });

```

please note for other calls that maybe does not have any metadata defined for them, `call.metadata.type` does not make any sense.
There is a syntax issue. You need to do this for sending metadata with a stream

```
let cameracall = peer.call(conn.peer, ourcamera, {
    metadata: { "type": "camera" }
});
let screencall = peer.call(conn.peer, ourscreen, {
    metadata: { "type": "help" }
});

```

And then at the peer end, you can get metadata like this

```
peer.on("call", connection => {
  connection.answer();
  connection.on("stream", stream => {
    console.log(connection.metadata);
  });
});

```