socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Socket.IO connection between two apps

Open waqas1991 opened this issue 12 years ago • 0 comments

Hi,

Recently I was working to display server side logs to the client with socket.io and successfully done it now I have to do another thing with socket.io which is to display the logs of another application. For example App 1 is running and it displaying its log to the browser and now I want App 1 should also display the log of App2.

Here is my code which I did so far do display App1 Logs on the browser.

app.js

    var app = express()
    ,server  = require('http').Server(app)
    ,io        = require('socket.io')(server)

    Tail = require('tail').Tail;

    server.listen(8080);

    io.sockets.once('connection', function(socket) {
    tail = new Tail("log.log");    // file to stream

    tail.on('line', function(data) {
    return io.sockets.emit('new-data', {
        channel: 'stdout',
        value: data
    });
   });     
   });

client.ejs

Owner


Other Repo Issues