Results 1 to 5 of 5
  1. #1

    Which Connection types are supported in Web Workers?

    Hello!

    I am currently attempting to move our web application's Lightstreamer client to a Web Worker. Unfortunately, the connection type which our application uses (XSXHRConnection) is failing an internal check due to the fact that the client is not living in a browser document.

    The JS client guide discusses Web Workers, but does not mention any limitations regarding which types of connections are supported. What are the connection types which should be used here?

    (As a side-note, we are using the version 6.1.4 client.)

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi smithpr,

    I can see that class correctly work on webworkers (using the same client 6.1.4 on Chrome Firefox and IE) thus I suppose that the problem lies elsewhere.

    Do you get any exception on the browser console? Does it say anything in the network tab of the browser console?
    How is the <cross_domain_policy> element in the server configuration set?
    Which browsers are you testing? (please also specify the version)

    HTH







  3. #3
    Hello, Mone!

    The class in question is failing a check for cookie support, which results in logging a message 223 ("Cookies on request are required, this class can't guarantee that cookies will be actually sent").

    In our main page thread, the class passes this check. Further digging into the source code has shown that the check for cookie support for XSXHRConnection passes iff the client is being run in the context of a browser document. Is this functionality intended?

    Browser: Chrome 43



    Edit 1:
    Our client runs into this issue after sending an initial call to the server, but before reqesting the usual bind_session.js or create_session.js

    Here is some relevant log output:
    LS Client in main thread (old version)
    Code:
    lightstreamer.protocol | DEBUG | 17:58:20,311 | Connection request generated {[|https://***********/lightstreamer||L...******&|POST|] }
    lightstreamer.stream | DEBUG | 17:58:20,311 | Searching for an appropriate connection class {true true true false }
    lightstreamer.stream | DEBUG | 17:58:20,312 | Verify if a connection class is appropriate {function k(){this._callSuperConstructor(k);this.k=!1;this.Ab=this.W=this.hc=this.t=null;this.mo=!1;this.P=k} }
    lightstreamer.stream | DEBUG | 17:58:20,312 | This class is good {}
    lightstreamer.protocol | DEBUG | 17:58:20,313 | Path selected {create_session.js }
    lightstreamer.stream | DEBUG | 17:58:20,314 | Sending request using CORS-XHR {https://***********/lightstreamer/create_session.js }
    lightstreamer.session | DEBUG | 17:58:20,315 | Connection open to the server {}
    LS Client in Web Worker (new version):
    Code:
     
    lightstreamer.protocol | DEBUG | 18:08:23,982 | Connection request generated {[|https://*********/lightstreamer||LS_phase=7701&LS_cause=new.api…9000&LS_client_version=6.1&LS_adapter_set=****&LS_user=*****&|POST|] }
    lightstreamer.stream | DEBUG | 18:08:23,983 | Searching for an appropriate connection {true true true false }
    lightstreamer.stream | DEBUG | 18:08:23,984 | Verify if a connection class is appropriate {function k(){this._callSuperConstructor(k);this.k=!1;this.Ab=this.W=this.hc=this.t=null;this.mo=!1;this.P=k} }
    lightstreamer.stream | DEBUG | 18:08:23,985 | Cookies on request are required, this class can't guarantee that cookies will be actually sent {}
    lightstreamer.stream | DEBUG | 18:08:23,985 | Searching for an appropriate connection class {function c(){this._callSuperConstructor(c);this.k=!1;this.pa=this.Ab=this.t=null;this.Sj=0;this.P=c} }
    lightstreamer.stream | DEBUG | 18:08:23,985 | This class is not available on the current environment {}
    lightstreamer.stream | DEBUG | 18:08:23,986 | Searching for an appropriate connection class {function l(){this._callSuperConstructor(l);this.error=this.response=this.hc=this.sender=this.t=null;this.k=!1;this.a=0;this.LS_x=this.gz;this.zd=null;this.P=l} }
    lightstreamer.stream | DEBUG | 18:08:23,986 | This class is not available on the current environment {}
    lightstreamer.stream | DEBUG | 18:08:23,986 | Searching for an appropriate connection class {function k(c){this._callSuperConstructor(k);this.originalTarget=c;this.target=c+b.randomG();this.Kb=new h(this.target,a.packTask(this.Qr,this));this.Ji=0;this.Qn="script_"+b.randomG();this.hf=null;this.wp=!1;this.Eq=!0;this.P=k} }
    lightstreamer.stream | DEBUG | 18:08:23,986 | This class is not available on the current environment {}
    lightstreamer.stream | DEBUG | 18:08:23,986 | Searching for an appropriate connection class {function q(a){this._callSuperConstructor(q);this.target=p.fk(a);this.Ec=0;this.k=!1;this.Ui=null;d.getFrameWindow(this.target,!0);this.P=q} }
    lightstreamer.stream | DEBUG | 18:08:23,986 | This class is not available on the current environment {}
    lightstreamer.stream | DEBUG | 18:08:23,987 | Restart connection selector {}
    lightstreamer.session | WARN | 18:08:23,987 | Unable to use available connections to connect to server {}
    Here are the specific classes which it evaluated, and the results:


    Class Logger Code Root Cause
    XSXHRConnection 223 Context is not a browser document, assumes no cookie support
    IEXSXHRConnection 221 No XDomainRequest (obsolete/legacy) functionality
    XHRConnection 221 Context is not a browser document
    JSONPConnection 221 Context is not a browser document
    FrameConnection 221 Context is not a browser document





    Edit 2:

    Here is our cross-domain policy element for this environment:
    Last edited by smithpr; May 29th, 2015 at 08:53 PM. Reason: Adding more information

  4. #4
    I'd also like to point out that the Lighstreamer Client started working when I commented out the check which was failing. Since that isn't a long-term solution, and some of our other environments actually require cookie support, it would be nice to know if the check was there for a reason, and if so what that reason is.

  5. #5
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi smithpr,

    Thanks for the analysis, you're right.
    That check is there because if you try to load an application from "file:" then use a XS XHR asking the withCredentials flag set to true (that's the flag that permits the cookies to get through) the request will reach the server but the client won't be able to read the answer.

    Clearly I didn't take into account web workers, sorry. I'm going to patch the lib now: please send an email to support@lightstreamer.com and I'll send a link to the officially patched library as soon as it is available (later today).

 

 

Similar Threads

  1. Which is the better fail over mechanisam
    By dimitarn in forum General
    Replies: 3
    Last Post: March 30th, 2010, 12:13 PM
  2. Which JAR?
    By lucab617 in forum Client APIs
    Replies: 2
    Last Post: May 19th, 2008, 10:44 AM
  3. Power PC supported?
    By lhotch in forum General
    Replies: 0
    Last Post: September 27th, 2007, 07:53 PM
  4. DISTINCT not supported in Stock Demo
    By gmccone in forum Client APIs
    Replies: 1
    Last Post: March 30th, 2007, 11:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 09:58 PM.