Giter Site home page Giter Site logo

No output on browser. about gwsocket HOT 3 CLOSED

allinurl avatar allinurl commented on May 13, 2024
No output on browser.

from gwsocket.

Comments (3)

skloeckner avatar skloeckner commented on May 13, 2024 1

I think I see now. I presumed it would just spit the output directly into my browser out of the pipe.

I did not know I needed to run some sort of web server or HTML file. From the demos, it did not seem necessary. Perhaps I presumed too much :D

Still, very cool indeed. Got it working.

I like your other project, goaccess. I was wondering if I could customize some of those subsections of the dashboard because it looks wicked awesome by default. I mainly just wanted straight output like this but for multiple commands on a ceph cluster. Perhaps I will review or open a ticket if I have a question.

Thanks for the quick reply.

from gwsocket.

allinurl avatar allinurl commented on May 13, 2024

How are you running gwsocket? I'd try this (make sure port 7890 is opened)

1.- Start the websocket server

    $ gwsocket &

2.- Send data from the server to the browser

    $ tail -f /var/log/syslog > /tmp/wspipein.fifo

3.- Then create an html file, e.g., logs.html that connects to the server (make sure you are pointing to the right IP/host where the gwsocket server is running and the port is open). In your case, it seems you are running gwsocket on the same machine as your syslog, so localhost would work.

<!DOCTYPE html>
<html lang="en">
<script>
window.onload = function() {
    function $(selector) {
        return document.querySelector(selector);
    }
    var socket = new WebSocket('ws://localhost:7890');
    socket.onopen = function(event) {
        $('#messages').innerHTML = 'Connected<br>';
    };
    socket.onmessage = function(event) {
        $('#messages').innerHTML += event.data + '<br>';
    };
    socket.onclose = function(event) {
        $('#messages').innerHTML = 'Disconnected ' + event.reason;
    };
};
</script>

<div id="page-wrapper">
    <pre id="messages">Connecting...</pre>
</div>

4.- Open the html file (Ctrl+o) and you should see your data from the server in the browser. Or just use file:///home/user/logs.html

Let me know if that helps.

from gwsocket.

allinurl avatar allinurl commented on May 13, 2024

That's right, you need to connect your web-page/app using a WebSocket to the gwsocket server. I'll make some changes to the documentation to make it a bit more clear. Thanks for the feedback :)

You can customize GoAccess' dashboard to a certain extend. Please take a look at the man page for more details.

Closing this. Feel free to reopen it if needed.

from gwsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.