PDA

View Full Version : Can't connect to lightstreamer in firefox


chuan_ckc
08-20-2009, 04:57 AM
Hi,

I have a push page which able to open with IE and also able to receive push data from Lightstreamer server. But when I try open it in firefox, there was no data showing and the engine seems cannot connect and keep attempt to connect to the Lightstreamer server. Following are my code on the engine configuration:

var lsPage = new PushPage();
var debugAlerts = true;
var remoteAlerts = true;
var pushHost = null;
var pushPort = 8080;

debugAlerts = true;
remoteAlerts = true;
pushHost = document.domain;

lsPage.context.setDebugAlertsOnClientError(debugAlerts);
lsPage.context.setRemoteAlertsOnClientError(remoteAlerts);

lsPage.onEngineCreation = function(lsEngine) {
lsEngine.context.setDebugAlertsOnClientError(debugAlerts);
lsEngine.context.setRemoteAlertsOnClientError(remoteAlerts);

lsEngine.connection.setLSHost(pushHost);
lsEngine.connection.setLSPort(pushPort);
lsEngine.connection.setAdapterName("RBMS");

lsEngine.policy.setMaxBandwidth(200);
lsEngine.policy.setIdleTimeout(30000);
lsEngine.policy.setPollingInterval(10000);

//lsEngine.onStatusChange = ChangeWindowStatus;
lsEngine.changeStatus("STREAMING");
}

lsPage.bind();
lsPage.createEngine("HelloWorldApp","LS","SHARE_SESSION");

/////////////////////////////////table handler
var commandTable = new NonVisualTable("NewUser", schemaCommand, "COMMAND");
//TABLE
commandTable.setSnapshotRequired(true);
commandTable.setRequestedMaxFrequency(0.5);
//NonVisualtable
commandTable.onItemUpdate = myUpdateHandler;
lsPage.addTable(commandTable, "news");


and from the server, I am keep watching the following command on each time firefox connecting to the server:

20.Aug.09 10:53:09,549 < INFO> Serving request: /lightstreamer/create_session.ht
ml?LS_phase=6301&LS_requested_max_bandwidth=200&LS_polling=true&LS_polling_milli
s=10000&LS_idle_millis=30000&LS_client_version=4.3&LS_adapter=RBMS& from 192.168
.1.21:1256
20.Aug.09 10:53:09,549 < WARN> Bandwidth control request ignored
20.Aug.09 10:53:09,549 < INFO> Starting new session: Sa889b5620686f3a6T5309549 f
rom 192.168.1.21:1256
20.Aug.09 10:53:09,549 <TRACE> RELEASING DATA --> HTTP/1.0 200 OK
Date: Thu, 20 Aug 2009 02:53:09 GMT
Server: Lightstreamer/3.5 build 1428.4 (Lightstreamer Push Server - www.lightstr
eamer.com) Moderato edition
Content-Type: text/html; charset=iso-8859-1
Cache-Control: no-store
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 1 Jan 1970 00:00:00 GMT
Content-Length: 927
Connection: Keep-Alive

<!--
-- LIGHTSTREAMER
-- Live Web Content Delivery
--
-- www.lightstreamer.com - info@lightstreamer.com
--
-- Copyright (c) 2004-2008 Weswit s.r.l. All Rights Reserved.
-->

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="Thu, 1 Jan 1970 00:00:00 GMT">
<title>Lightstreamer is pushing...</title>

<script language="JavaScript" src="/lightstreamer/pushFrameSettings.js">
</script>
</head>

<body onload="if (! clsd) { retry(); }">
<script>setPhase(6301);</script><script>start('Sa889b5620686f3a6T5309549', null,
30000, 50000, 'Lightstreamer HTTP Server');</script><script>s0(0.0,1.0,-1.0);</
script><script>loop(10000);</script><script>
end(); clsd = true;
</script>

</body>
</html>


Appreciated if someone can help. Thank you.

Chuan

Alessandro
08-20-2009, 11:18 AM
There is a wrong configuration in pushHost. It cannot be the same as the document.domain.

What is your deployment architecture, with or without a Web Server? If you have a Web Server, is it on the same host of Lightstreamer Server or a different host?

chuan_ckc
08-20-2009, 06:03 PM
There is a wrong configuration in pushHost. It cannot be the same as the document.domain.

What is your deployment architecture, with or without a Web Server? If you have a Web Server, is it on the same host of Lightstreamer Server or a different host?

Yes, I have a web server in the deployment. The web server is on the same host with Lightstreamer server. There is no problem when I open the web client/push page, it was able to receive the push data from Lightstreamer server. Just that the same push page seems having some problems when connecting to Lightstreamer server on Firefox.

And regarding the deployment architecture, I try to separated the Lightstreamer server and web server into 2 different host, and the Lightstreamer server is assigned a sub domain (push.abc.com) of the web server (www.abc.com). I set the pushHost = "push.abc.com" (on the push page) and open it and I get permission denied. Therefore I put both the Lightstreamer and Web Server on the same host and set the pushHost = document.domain. It works on IE but not Firefox.

Chuan

DarioCrivelli
08-21-2009, 10:42 AM
If the Web Server is on www.abc.com and Lightstreamer Server is on push.abc.com,
you can make them communicate if you set the domain as abc.com.
Note that you must set the domain through the library-provided setDomain method
(follow the note in point 6 of GETTING_STARTED.TXT);
I can't find the call in your code snippet.

If you use the same host for both servers, with different ports,
there is no domain setting that works on both IE and FF;
if you don't set the domain at all (or call setDomain(null) ), this works only in IE.
According to the above, in the setDomain docs (http://www.lightstreamer.com/docs/client_web_jsdoc/Context.html#setDomain), we claim that we don't support the case for production scenario.

chuan_ckc
08-21-2009, 11:53 AM
If the Web Server is on www.abc.com and Lightstreamer Server is on push.abc.com,
you can make them communicate if you set the domain as abc.com.
Note that you must set the domain through the library-provided setDomain method
(follow the note in point 6 of GETTING_STARTED.TXT);
I can't find the call in your code snippet.

If you use the same host for both servers, with different ports,
there is no domain setting that works on both IE and FF;
if you don't set the domain at all (or call setDomain(null) ), this works only in IE.
According to the above, in the setDomain docs (http://www.lightstreamer.com/docs/client_web_jsdoc/Context.html#setDomain), we claim that we don't support the case for production scenario.

Thanks Dario, I am now trying to set up the lightstreamer server on another host which is different with the web server. But due to some network problem I can't access it at the moment. I update here later on any updates.

Just that there is an issue which our team is more concerning is the firefox issue. We are wondering why the same push page able to run on the IE but not in firefox. I have posted on the first post in this thread.

Thanks

Alessandro
08-21-2009, 12:19 PM
Security restrictions concerning cross-frame and cross-domain communication may be slightly different across different browsers. But if you follow the instructions provided in our documentation carefully, we guarantee a consistent behavior across all browsers.

chuan_ckc
08-21-2009, 01:02 PM
Hi Dario,

I have deploy the Lightstreamer server to another host which is different with the web server. The Lighstreamer server using the domain gts.vcb.com; while the web server using www.vcb.com. I set the domain using setDomain method and set the pushHost as follow:

var lsPage = new PushPage();
var debugAlerts = true;
var remoteAlerts = false;
var pushHost = null;
var pushPort = 3633;

debugAlerts = false;
remoteAlerts = true;
pushHost = "gts.vcb.com";

lsPage.context.setDomain("vcb.com");
lsPage.context.setDebugAlertsOnClientError(debugAlerts);
lsPage.context.setRemoteAlertsOnClientError(remoteAlerts);

lsPage.onEngineCreation = function(lsEngine) {
lsEngine.context.setDebugAlertsOnClientError(debugAlerts);
lsEngine.context.setRemoteAlertsOnClientError(remoteAlerts);

lsEngine.connection.setLSHost(pushHost);
lsEngine.connection.setLSPort(pushPort);
lsEngine.connection.setAdapterName("RBMS");

lsEngine.policy.setMaxBandwidth(200);
lsEngine.policy.setIdleTimeout(30000);
lsEngine.policy.setPollingInterval(10000);

//lsEngine.onStatusChange = ChangeWindowStatus;
lsEngine.changeStatus("STREAMING");
}

lsPage.bind();
lsPage.createEngine("HelloWorldApp","LS","SHARE_SESSION");



But the push page still having the connection problem. The browser's status bar shows "Lightstreamer is disconnected" and the server see no response. I am still wondering how to connect it with two different host. Please correct me if I'm wrong. Thank you.

chuan_ckc
08-24-2009, 11:46 AM
I have added the lsPage.context.setDomain() on the engine configuration, and the push page is able to open with firefox now but I am not sure whether I miss something or what, the lsPage.context.setDomain() seems doesn't work on IE browser and prompt me the following message while connecting:

1: 17:43:21,255 ER bind Unable to find the Engine. Retrying. If the problem persists, please check your configuration.

Therefore I have added the browser detection in the script and call the seDomain method accordingly. Both IE and firefox are working now.

Mone
08-24-2009, 12:51 PM
Hi,

which hostname do you use on the browser address bar to reach your page?
please read setDomain documentation (http://www.lightstreamer.com/docs/client_web_jsdoc/Context.html#setDomain) and check the Known Browser Issue (http://www.lightstreamer.com/vb/forumdisplay.php?f=22) section of the forum.
Following our guidelines you should be able to run your application without any browser detection code.

chuan_ckc
08-25-2009, 06:16 AM
Hi Mone,

Maybe I have miss something because the previous issue only happened on the same host architecture on our testing server. When I deploy it on the separate host architecture (different host of Lightstreamer server and web server), it works on both IE and Firefox browser.


Security restrictions concerning cross-frame and cross-domain communication may be slightly different across different browsers. But if you follow the instructions provided in our documentation carefully, we guarantee a consistent behavior across all browsers.

the separate two server to two different host issue is solve, it happen because of the setDomain command missing, I left out this command line previously :p . Currently the issues are done but I will go through lot more testing again anyway.

Thanks a lot for all the information.