kakserpom / phpdaemon

Asynchronous server-side framework for network applications implemented in PHP using libevent
http://daemon.io/
GNU Lesser General Public License v3.0
1.53k stars 231 forks source link

file locations #175

Closed ihabtawfig closed 10 years ago

ihabtawfig commented 10 years ago

I want to listen to data comming to my server in port 8047, I have installed phpdaemon application in: /opt/phpdaemon/PHPDaemon/Applications/ExmpleWebSocket.php My phpd.conf is:

user root;
group root;
max-workers 8; 
min-workers 1; 
start-workers 1; 
max-idle 0; 
ExampleWebSocket{}
#WebSocketOverCOMET.php {}
include conf.d/*.conf;

But nothing is happening when I telnet myserver:8047 also I used the test_socket.html (located in /var/www/html/) to test the socket with code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>WebSocket test page</title>
</head>
<body>
<script type="text/javascript">
    function create() {
        // Example
        ws = new WebSocket('ws://'+document.domain+':8047/exampleApp');
        ws.onopen = function () {document.getElementById('log').innerHTML += 'WebSocket opened <br/>';}
        ws.onmessage = function (e) {document.getElementById('log').innerHTML += 'WebSocket message: '+e.data+' <br/>';}
        ws.onclose = function () {document.getElementById('log').innerHTML += 'WebSocket closed <br/>';}
    }
</script>
<button onclick="create();">Create WebSocket</button>
<button onclick="ws.send('ping');">Send ping</button>
<button onclick="ws.close();">Close WebSocket</button>
<div id="log" style="width:300px; height: 300px; border: 1px solid #999999; overflow:auto;"></div>
</body>
</html>

the socket is opened but no data in tty log. thanks in advance for your help.

kakserpom commented 10 years ago

Why do you use WebSocket for that? Are you sure that you want WebSocket? As far as I understand you need to look at ExampleTelneyneypot. Example of simple server.

ihabtawfig commented 10 years ago

Kakserpom, Thanks a lot, that was exactly what I needed for now. I really hope I can learn more about WebSocket for future usage, just waiting for a little "High Level" usage documentation :) , thanks again