I used this code within the lightstreamer/adapters/HelloWorld/classes
(I'm running lighrstreamer in 8880 port)

//HelloWorldDataAdapter.php
<?
$server = '127.0.0.1';
$syncPort = 7001;
$asyncPort = 7002;


$control = fsockopen($server, $syncPort, $errno, $errstr, 5) or die($errno." : ".$errstr."\n");
$feed = fsockopen($server, $asyncPort, $errno, $errstr, 5) or die($errno." : ".$errstr."\n");


$greeting = fscanf($control, "%s\n");
$sid = explode('|', $greeting[0]);
$sid = $sid[0];


fwrite($control, $sid."|SUB|V\n");
$cnt = 0;
while (true) {
$qry = "0|UD3|S|greetings|S|".$sid."|B|0|S|message|S| Do you count the following?|S|timestamp|S|Count: ".$cnt."\n";
fwrite($feed, $qry);
$cnt++;
sleep(2);
}


fclose($feed);
fclose($control);
?>

and added the client file as
<!DOCTYPE html>
<html>
<head>
<title>Hello World with Lightstreamer</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.7/require.min.js"></script>
<script src="lightstreamer.js"></script>
</head>


<body>
<div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="message">loading...</div>
<div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="timestamp">loading...</div>
<div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="samplename">loading...</div>


<script>
require(["LightstreamerClient","Subscription","StaticGr id"],function(LightstreamerClient,Subscription,StaticG rid) {
var client = new LightstreamerClient("http://localhost:8880/","HELLOWORLD");
client.connect();

var grid = new StaticGrid("hellogrid",true);

var subscription = new Subscription("MERGE",grid.extractItemList(),grid.e xtractFieldList());
subscription.addListener(grid);
subscription.setDataAdapter("helloworld");

client.subscribe(subscription);
});
</script>
</body>
</html>


and added the adapter xml file as(lightstreamer/adapters/HelloWorld/adapters.xml)

<?xml version="1.0"?>
<adapters_conf id="HELLOWORLD">
<metadata_provider>
<adapter_class>com.lightstreamer.adapters.metadata .LiteralBasedProvider</adapter_class>
</metadata_provider>
<data_provider name="helloworld">
<adapter_class>HelloWorldDataAdapter</adapter_class>
</data_provider>

</adapters_conf>


I created the client and server file as mentioned above structure. I'm also having doubt in creating file structure. Whether it is correct or having problem. If it is wrong means please give me an example of file constructing structure.If i used java as an adapter means it's running well.