1.0.0 • Published 7 years ago

socket.io-token v1.0.0

Weekly downloads
5
License
MIT
Repository
-
Last release
7 years ago

Socket.io token middleware

socket.io token verification middleware

Usage:

NPM

npm install --save socket.io-token

example

const io = require("socket.io")
const socketToken = require("socket.io-token")

io.on("connection", (socket) => {
    socket.use(socketToken({
        query: "token",
        verifyFuntional: (token, callback) => {
            if (true) { // success
                callback(true);
            } else { // fail
                callback(false);
            }
            //...
        }
    }))
})

Options:

  • verifyFuntional (Function) custom verify function.
  • query (String) socket.io-client query key name.
  • token (Stirng) 自己手动获取的token
  • secretOrPublicKey (String)

changelog

  • 1.0.1 Fix error
  • 1.0.2 Fix docs
1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago