Skip to content

Using nodemonkey on production #37

@kksharma1618

Description

@kksharma1618

Hey,

First of all, thanks for developing nodemonkey. I just stumbled onto this, and I am really excited to use this in our apps.

I want to use this in some of our production apps, and for that I think we will need the changes listed below. I am just about to fork this project and work on it myself. I just wanted your input on these. Do these changes make sense to you? Will you be interested in merging them back if I send PR?

Changes

Use socketio-auth for security

https://www.npmjs.com/package/socketio-auth

User can maybe provide some options like this:

{
    "users": [
        {
            "user": "userid",
            "password": "password"
        }
    ]    
}

Then the page that hosts debugger (client.html or custom page), will need to provide user and password to use (window.nomoUser, window.nomoPassword). client.js will use this user and password to authenticate socket.io.

Allow for light weight start() and stop() functions

User will want to enable debugger dynamically in production. No point in running debugger when you are not using it.

I, for example, would want to create some endpoint like this in my server:

POST /debugger
headers:
enable: 0/1
token: "some predetermined token"

this will call nomo.start or stop

For above reasons, lightweight version of start will be needed.

Current start():

  • uses fs.readFileSync variants to read files for serving them
  • generates template for client.js from provided options

Need to divide that into two functions.

init():

  • sets config
  • reads client.js. uses template and options to dynamically generate client.out.js

start():

  • uses fs.readFile variants to serve needed files
  • uses client.out.js instead of client.js
  • adds proper cache headers for all js files, except client.out.js
  • starts server and io. and do the rest

Allow for limits on msgbuffer array in server side

Currently it will keep growing if no active sockets are there. We can provide option "serverMaxBuffer" and use it to maintain msgbuffer size.

An optional enhancement in client.js

It will be helpful if we can filter messages to be logged in browser's console. For example, in our apps we have dedicated debugger functions for different modules. They emebed moduleId along with current date to all the logged messages.

If we can provide a filter function to client.js, each developer will be able to see just the messages that they are interested in.

client.js can check if window.nomoFilterMessages function exists, and use it to filter messages.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions