1
votes

Got a tough one here.

So, we're trying to upgrade an OpenTok video chat application from Flash to WebRTC, and are running into socket errors as we try to implement the 'helloworld' WebRTC sample. The errors occur when we try to do a session.connect() call, not when we request a sessionId or a token. And the error basically looks like this (session_id and partner_id anonymized):

SessionInfo Response: 
#document
  <sessions>​
    <Session>​
      <session_id>​asfgdagbasdfovnwoinvcwoinvoiandfvoinvoidnofgfdfgfgivniodfnv-sdfgdfgdfg-​</session_id>​
      <partner_id>​1234567890​</partner_id>​
      <create_dt>​Sun Sep 01 12:00:45 PDT 2013​</create_dt>​
      <session_status>​INFLIGHT​</session_status>​
      <media_server_url>​…​</media_server_url>​
      <p2p_server_url>​rtmfp://p2p101-oak.tokbox.com:1945/multicast​</p2p_server_url>​
      <media_server_hostname>​oms409-oak.tokbox.com​</media_server_hostname>​
      <messaging_server_url>​oms409-oak.tokbox.com​</messaging_server_url>​
    </Session>​
  </sessions>​
connectToMessenger
WebSocket error: undefined
TB.Socket Error :: The socket to oms409-oak.tokbox.com received an error: Unknown Error
TB.exception :: title: Connect Failed (1006) msg: TB.Socket Error :: The socket to oms409-oak.tokbox.com received an error: Unknown Error

Any ideas on what might be causing this? We're testing on the latest version of Chrome 29, and it happens in both localhost and on our production servers. So it doesn't seem to be a firewall. The one thing I can think of is that we're running on a Meteor/Node.js framework, which has websockets enabled by default. The code is pretty much boilerplate helloworld sample from the following:

http://tokbox.com/opentok/tutorials/hello-world/js/demo.html

We get the sessionId and token successfully, it's just that the session.connect() doesn't ever happen (and, thus, we can't ever get our connection object or subscribe to the event listeners).

Any ideas on how we might go about debugging this issue? Thanks in advance for any help! abigail

2

2 Answers

2
votes

In typical fashion, after I spend two days on a bug, get so frustrated that I post a question to StackOverflow, and then figure it out an hour later.

Long story short, the OpenTok account had an 'enable WebRTC' option that wasn't set. It was an account administrator issue. Long story short... make sure devs have access to the accounts the business folks have!

1
votes

I think you might be using the flash js library instead of the webrtc library. If you had joined your session using flash, it will not be able to work with webrtc.

Here's the webrtc library:

<script src='https://swww.tokbox.com/webrtc/v2.0/js/TB.min.js'></script>

Here is the flash library:

<script src='https://swww.tokbox.com/v1.1/js/TB.min.js'></script>

Think of webrtc and flash as two separate products, they do not interoperate.