Results 1 to 10 of 10

Hybrid View

  1. #1
    Senior Member
    Join Date
    Oct 2009
    Location
    cbba
    Posts
    33
    here is my push code

    HTML Code:
    <html>
    
    <head>
    	<title>Hello World with Lightstreamer</title>
    	<script language="JavaScript" src="LS/lscommons.js"></script>
    	<script language="JavaScript" src="LS/lspushpage.js"></script>
    </head>
    
    <script>
    	var page = new PushPage();
    	page.context.setDomain("<?=$gsDomain?>"); // dominio.com
    	page.onEngineCreation = function(engine) {
    		engine.connection.setLSHost("<?=$gsLSHost?>"); // push.dominio.com
    		engine.connection.setLSPort(<?=$gsLSPort?>);
    		engine.connection.setAdapterName("ECONOTIFICATIONS");
    		engine.changeStatus("STREAMING");
    	}
    	page.bind();
    	page.createEngine("EcoNotificationsApp", "LS", "SHARE_SESSION");
    	
    	var group = ["<?=$sItemName?>"];
    	var schema = ["message","timestamp"];
    	var pushtable = new NonVisualTable(group, schema, "MERGE");
    	pushtable.setCommandLogic(true);
    	pushtable.setDataAdapter("EcoNotifications");
    	pushtable.setSnapshotRequired(true);
    	pushtable.onItemUpdate = function (itemPos, updateInfo, itemName) {
    		var sMsg = updateInfo.getNewValue("message");
    		var sDate = updateInfo.getNewValue("timestamp")
    		if(sMsg!=null){
    			var objDivAlarm = document.getElementById("divAlarm");
    			objDivAlarm.innerHTML = sMsg + "<br>" + sDate;
    		}
    	};
    	pushtable.onStart = function() {
    		
    	};
    	
    	/*var pushtable = new OverwriteTable(null, null, "MERGE");*/
    	page.addTable(pushtable, "hellotable");
    </script>
    
    <body>
    
    <div id="divAlarm">Empty...</div>
    
    </body>
    </html>

  2. #2
    Senior Member
    Join Date
    Oct 2009
    Location
    cbba
    Posts
    33
    i think i identified the problem, i'm not sure if this is a bug or not.

    the problem occurs when i put the "LS" folder (with JS libraries of Lightstreamer) into a "lib" folder. something like this:
    Code:
    myapp/
    myapp/lib/LS/... --> here is the JS library
    myapp/lsAlarms.php
    in lsAlarms.php add the path in the src
    HTML Code:
    <script language="JavaScript" src="lib/LS/lscommons.js"></script>
    <script language="JavaScript" src="lib/LS/lspushpage.js"></script>

    when i move the "LS lib" to the same level to lsAlarms.php and lib, almost everything works fine (I'll open another post to see to solve another problem). something like this:
    Code:
    myapp/
    myapp/lib/
    myapp/LS/... --> here is the JS library
    myapp/lsAlarms.php
    in lsAlarms.php add the path in the src
    HTML Code:
    <script language="JavaScript" src="LS/lscommons.js"></script>
    <script language="JavaScript" src="LS/lspushpage.js"></script>

    i don't understand why this happends, maybe it's a bug. if you solve this, please let me know.

  3. #3
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    hi,

    if you move the libraries you must update, besides the <script> tags, the createEngine call that needs to know where are the libraries located.
    So you can put the LS folder under lib but your createEngine must look like this:

  4. #4
    Senior Member
    Join Date
    Oct 2009
    Location
    cbba
    Posts
    33
    thank you very much, i read that part, but i had not entirely clear, thanks for your help, now works.

    regards.

 

 

Similar Threads

  1. Don't send message when refresh the browser
    By naitsir in forum Client SDKs
    Replies: 7
    Last Post: October 2nd, 2012, 10:36 AM
  2. How to send message to each client?
    By hungtt in forum Adapter SDKs
    Replies: 7
    Last Post: December 30th, 2010, 03:42 AM
  3. Replies: 6
    Last Post: December 7th, 2010, 09:26 AM
  4. Replies: 1
    Last Post: January 18th, 2010, 03:27 PM
  5. How to send params from client to server
    By kanibal210 in forum Client SDKs
    Replies: 1
    Last Post: September 30th, 2009, 08:36 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 08:36 AM.