Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Wraps socket.io event handlers to prevent crashes from certain malicious inputs.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.npmignore
LICENSE
README.md
package.json
safesocket.js

README.md

safesocket

Wraps socket.io event handlers to prevent crashes from certain malicious inputs.

Usage

The first parameter passed to safesocket is the expected number of (non-function) arguments. The second parameter is the handler function to wrap. This function will always be called with exactly expected + 1 arguments, and the last argument will always be a Function.

var safesocket = require('safesocket');

socket.on('ping', safesocket(2, function (name, location, callback) {
    console.log('Pinged from ' + name + '/' + location);
    callback('pong');
}));

License

The MIT License (MIT)

Something went wrong with that request. Please try again.