[Laszlo-dev] NetConnection Parameters on RTMPConnection

Max Carlson max at openlaszlo.org
Sun Dec 27 16:19:31 PST 2009


On 12/24/09 1:41 PM, Lucas Lain wrote:
> Hello Everybody,
>
> I'm trying to modify the class rtmpconnection to allow connection parameters.
> I can't get the parameters to work. I tried to sniff the tcp
> connection (I'm using rtmpt), but I can't see the parameters on the
> tcp stream. I'm using red5 on the other side, and the server says that
> the parameters received are 0. I think that the parameters are not
> working on my SWF side.
>
> Can you help me debug where my problem is? I ran out of ideas about
> where to look. I can't look inside NetConnection (_nc).
>
> I'm using OL 4.6.1.
>
> On my SWF client:
>
>                  var connParams = new Array();
>                  connParams["key"] = 'KEY1234124231';
>                  rtmp.connect(connParams);
>
>
> I modified two lines (the ones that say "HERE"). Here is the extracted
> code from rtmpconnection.lzx :
>
>              <!--- Connect to the rtmp server. -->
>              <method name="connect" args="connParams"><![CDATA[   //<-- HERE
>                  //Debug.write("rtmpconnection.connect, stage", this.stage);
>                  if (this.stage>  0) {
>                      return; // already connected or connecting
>                  }
>
>                  var src = this._usealtsrc ? this.altsrc : this.src;
>                  if (src == 'null') src = null;
>
>                  if (this.debug) {
>                      if ($debug) Debug.write("initiating connection to ", src);
>                  }
>
>                  if ($debug) {
>                      if (src == "") {
>                          Debug.write("no src url defined for", this);
>                          return;
>                      } else if (typeof(src) != "string") {
>                          Debug.write("src", src, "must be a string in", this);
>                          return;
>                      }
>                  }
>
>                  this._connecturl = src;
>
>                  this._createconnection();
>                  Debug.write(connParams);
>                  this._nc.connect(src,connParams);
> ///////////////////<-- HERE
>                  // I think the only option is to ethereal
>
>                  this.setAttribute("status", "connecting");
>                  this.setAttribute("stage", 1);
>                  if (! this['_connectionTimeoutDel'])
> this._connectionTimeoutDel = new LzDelegate(this,
> '_handleConnectionTimeout');
>                  lz.Timer.addTimer( this._connectionTimeoutDel,
> this.connectiontimeout );
>              ]]>
>              </method>
>
> Thanks in advance.
> Regards,
>

Hi,

It looks like your changes _should_ work, according to the Adobe docs. 
The fact that sniffing the connection shows nothing indicated the client 
isn't sending anything.  Have your tried sending a simple String or 
other parameter when calling connect()?

It's possible connect() is being called from elsewhere.  You could try 
running in backtrace mode by checking 'backtrace' in the developer's 
console.  Next, click on the debugger message(s) to see the full backtrace.

Sometimes, running the Flash debug player can help catch certain kinds 
of exceptions: http://www.adobe.com/support/flashplayer/downloads.html

Let me know what happens!

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list