Open ghost opened 12 years ago
I got both examples working but not by the methods stated, which I am sure is my mistake. I would like to know why it is...
First, I made corrections to the default VirtualHosts tags: changing the VirtualHosts tags from VirtualHost 127.0.0.1 to VirtualHost :80 Second, I had to make a similar change in the ports.conf, changing to: NameVirtualHost :80 and Listen 80 Third, I was then able to run both the echo and dumb-increment examples BUT ONLY if I copied their respective file contents into "var/www/index.html" Fourth, I changed the httpd.conf file to read:
LoadModule websocket_module /usr/lib/apache2/modules/mod_websocket.so
LoadModule websocket_draft76_module /usr/lib/apache2/modules/mod_websocket_draft76.so
<IfModule mod_websocket.c>
<Location /echo>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_echo.so echo_init
</Location>
<Location /dumb-increment>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_dumb_increment.so dumb_increment_init
</Location>
</IfModule>
<IfModule mod_websocket_draft76.c>
<Location /echo>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_echo.so echo_init
SupportDraft75 On
</Location>
<Location /dumb-increment>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_dumb_increment.so dumb_increment_init
SupportDraft75 On
</Location>
</IfModule>
My understanding is that if I placed the client.html and the increment.html files within var/www/echo/client.html and var/www/dumb-increment/increment.html then I would be able to browse to http://localhost/echo/client.html and http://localhost/dumb-increment/increment.html to see them work, but that never worked. When I did that, the apache2 error logs gave a 301 error (permanently moved).
Obviously, I am misunderstanding something simple. If the answer is too complex for your time, can you advise on what I should be reading up on? (Thanks.)
I can't speak much for the virtual host issues, but you should be able to put client.html and increment.html into var/www/ and then just access using http://localhost/client.html and http://localhost/increment.html. The /echo and /dumb-increment references are just a way of matching a handler to a path contained in a WebSocket request. Don't try to load your HTML file from there.
As for starting/stopping apache, I always use "sudo apachectl restart".
I apologize for missing the obvious, perhaps my ignorance will help others in the future. Thanks.
BTW, I have the same issue now as #8, disconnecting after about 10 seconds. Is the only solution to this issue what he had done (changing the RequestReadTimeout)?
Finally, I had read a post from the guy who owns "pusher" and a few others who tend to claim that Apache is not a good or reliable server for WebSockets. That would be pretty bad if it's true as I see WebSockets as coming on strong in the near future. Have you heard more about Apache implementing your code? You seem to have the only solution for making WebSockets work in Apache.
Thanks for your work.
For now, use the RequestReadTimeout to workaround the timeout issue.
I had an interest in using WebSockets and was locked in to using an Apache server, so I created the module. I haven't seen the "pusher" guy's claim about Apache. However, from my own experience, I haven't had any problems with it. It has been very reliable for me, and it gets the job done.
I have the same problem, the connection is closed after 10-11 seconds, in both examples. It's very strange, cause the server seems to work perfectly, sending the numbers well. Let me explain. I ran the page and the numbers came without problem. If a click 'Reset' before the 10 seconds, the 'Reset' is correctly processed in the server, and the coount restart at 0, sending the numbers correctly. And continues receiving the numbers to the infinite (well, I didn't wait till infinite) but if I clicked 'Reset' (after 10 seconds from the page load), the connections came closed.
I saw the event raised in javascript, and is more strange cause it said it's a clean close:
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
code: 1000
currentTarget: WebSocket
defaultPrevented: false
eventPhase: 0
reason: ""
returnValue: true
srcElement: WebSocket
target: WebSocket
timeStamp: 1363015161151
type: "close"
wasClean: true
Websockets seems to be the best option for realtime solutions but it's not usable with a timeout. I can send you any information you need.
Thanks for the great job.
I ran into the timeout issue too, and found that setting the timeout value to 0 apparently keeps the connection open forever.
This is what I put in my httpd.conf: RequestReadTimeout body=0,minrate=500
And now the connection stays open for many hours.
Noobish, my apologies,
Software: Ubuntu 11.04, Apache2 2.2.17, Firefox 12, Chromium 18.
Steps:
Notes: I am using your httpd.conf for ubuntu:
The client.html is at var/www/client.html with : www-data (group) and 777 permissions, and I have also tried root : root with 755
The virtual directive for default is
Can you advise on why I am only getting "Connection Closed" in the browser and the "Permission denied when restarting using the sudo /etc/init.d/apache2 restart command?