Categories:
Cloud (204)
Entertainment (11)
Facebook (43)
General (50)
Life (31)
Programming (64)
Technology (398)
Testing (4)
Tools (488)
Twitter (5)
Wearable (26)
Web Design (44)
Collections:
Other Resources:
Test GoAccess WebSocket Server
How to Test GoAccess WebSocket Server?
✍: FYIcenter.com
If you are running GoAccess real-time log report using its WebSocket server, you can use these steps to test it.
1. Run GoAccess as a WebSocket server as shown in the last tutorial:
$ sudo goaccess /var/log/httpd/access_log -o /var/www/html/report.html --real-time-html --daemonize WebSocket server ready to accept new client connections
2. Test port 7890 locally on the server using "telnet" command. Remember to press <Enter> key twice to send out an empty request.
$ telnet 127.0.0.1 7890 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. HTTP/1.1 400 Invalid Request Connection closed by foreign host.
The "HTTP/1.1 400 Invalid Request" message indicates that the WebSocket Server is running on port 7890.
If you get the "Connection refused" message, then no server is running on port 7890.
$ telnet 127.0.0.1 7890 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
3. Test port 7890 remote using "telnet" command. Remember to press <Enter> key twice to send out an empty request.
$ telnet faq.fyicenter.com 7890 ... HTTP/1.1 400 Invalid Request Connection closed by foreign host.
The "HTTP/1.1 400 Invalid Request" message indicates that the WebSocket Server is running on port 7890 and accessible remotely.
4. Send a WebSocket request with "curl" command:
$ curl -H "Upgrade: websocket" \ -H "Connection: Upgrade" \ -H "Origin: http://goaccess.io" \ -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \ -H "Sec-WebSocket-Protocol: chat" \ -H "Sec-WebSocket-Version: 13" \ -D header.txt http://127.0.0.1:7890/chat <81>~.<DB>{"general": {"start_date": "12/Dec/2022","end_date": "12/Dec/2022", "date_time": "2022-12-12 06:23:11 +0800","total_requests": 14,"valid_requests": 14, "failed_requests": 0,"generation_time": 1,"unique_visitors": 3,"unique_files": 4, "excluded_hits": 0,"unique_referrers": 0,"unique_not_found": 3,"unique_static_files": 2, "log_size": 2718,"bandwidth": 1825378,"log_path": ["\/var\/log\/httpd\/access_log"]}, "visitors": {"metadata": {"bytes": {"total": {"value": 1825378},"avg": {"value": 1825378, "percent": "100.00"},"max": {"value": 1825378,"percent": "100.00"}, "min": {"value": 1825378,"percent": "100.00"}},"visitors": {"total": {"value": 3}, "avg": {"value": 3,"percent": "100.00"},"max": {"value": 3,"percent": "100.00"}, ... <Ctrl>-C
5. Check the WebSocket response headers:
$ curl -H "Upgrade: websocket" \ more header.txt HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
⇒ GoAccess - Frequently Asked Questions
⇐ How GoAccess Real-Time Report Works
2022-12-12, 330🔥, 0💬
Popular Posts:
How to create a new PowerPoint presentation from a PowerPoint template? I have a PowerPoint template...
How to apply a character style in Microsoft Word? I want to emphasize few words in a paragraph. Appl...
"Muss i denn" is a German folk song in the Swabian German dialect. The present form dates back to 18...
Why am I getting the "You now have two copies of a file" error from OneDrive for Windows? You will g...
What is "Send to Bluetooth" in Microsoft Word? Should I disable it? "Send to Bluetooth" is a COM Add...