Skip to content

zehome/wslogtail

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

========================= Redis to websocket logger

+------------+            +-----+
|  Producer  | +--------> |Redis|
+------------+            +--+--+
                             |
                             |
       +-------+             |             +---------+
       |logfile| <-----------+-----------> |websocket|
       +---+---+                           +---+-----+
           |                                   ^
           |                                   |
           +-----------------------------------+

Server

pip3 install wslogtail
mkdir ~/wslogtail
wslogtail --logdir ~/wslogtail

Producer

redis-cli publish wslogger:log.name "bonjour, monde cruel"

Web client

<!doctype html>
<html>
  <head>
    <script>
    var con = new WebSocket("ws://localhost:8756/log.name");
    con.onerror = function(error) {
        console.log("err", error);
    };
    con.onmessage = function(e) {
        console.log("received", JSON.parse(e.data)["line"]);
    };
    </script>
  </head>
  <body>
    <p>Watch your console.</p>
  </body>
</html>

About

Log tail, from redis pubsub to logfile (buffer) and websocket stream

Resources

Stars

Watchers

Forks

Packages

No packages published