GithubHelp home page GithubHelp logo

node-websocket-log-server's Introduction

About this project

This is a server for logs using websocket.

When I was debugging on my mobile phone, I found it it difficult to known what is happened in the browser. As to the PC browsers, log messages helps me a lot. So I have tried many methods to record log messages on mobile phones.

I've tried to use Ajax(XHR) requests to send log message to server. But it is very inefficiency. I've also tried to add a little log panel on the page to display logs. But it is really annoying - it shields and blocks the page elements. I've also tried chrome remote debugging tools, but it won't work for Safari and UC Browser.

Finally, WebSocket became my last choose. So this project started.

Install using npm

Install locally:

npm install --save websocket-log-server

Install globally:

npm install -g websocket-log-server

Start the server

If installed locally:

./node_modules/.bin/websocket-log-server <HOST> <PORT>

If install globally:

websocket-log-server <HOST> <PORT>

Use the client:

// you can use it just like the global `console`
// i.e:
const console = require('websocket-log-server/client')
console.log("hello world!") // => if the websocket-log-server is running, this message will be on the console of server.

Note: if you want to use a different host or port other than 127.0.0.1:9998, you should call init(host, port) before start to use the log(msg) method. For example:

const console = require('websocket-log-server/client').init('192.168.1.1', '8888')
console.log("hello world!") // => if the websocket-log-server is running, this message will be on the console of server.

A full example is here: node-websocket-log-server-demo

node-websocket-log-server's People

Contributors

clarence-pan avatar kolobok12309 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-websocket-log-server's Issues

Client must wait before websocket is connected

I guess you need to queue messages and wait for the connection to be established before you start sending messages to the web server from the client, I am getting this if logging immediately (works fine once it's connected)

WebSocket log failed: InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.

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.