erbbysam / webRTCCopy

A simple file sharing application using webRTC-data.io
251 stars 45 forks source link

How do you use dataChannelChat.send(id, event.target.result); #17

Closed nadeemarain closed 9 years ago

nadeemarain commented 10 years ago

I tried this thing and it says signature is not defined and then I found this function you have defined...

send: function(connection, message) { var channel = rtc.dataChannels[connection]; if (rtc.connection_ok_to_send[connection]) { if (encryption_type != "NONE") { otr_send_msg(connection,message); } else { channel.send(message); } } else { console.log("unable to send message to " + connection); } },

I am not using any encryption, so I am using simple channel.send (rtcChannel.send in my case). So when I remove id from the dataChannelChat.send(id, event.target.result), I get the following error:

Uncaught NetworkError: Failed to execute 'send' on 'RTCDataChannel': Could not send data controllers.js:1029 reader.onload

Can you tell me what is the issue?

erbbysam commented 10 years ago

Sorry for the slow reply... I think the id variable is needed there to look up channel in the array rtc.dataChannels

Generally, I think all the OTR related code is wrapped in a if statement around the global variable encryption_type Thanks, Sam

erbbysam commented 9 years ago

Closing for now. Feel free to reopen. -Sam