Skip to content

nqnghia285/socket.io-cookies-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socket.IO Cookies Parser Build Status

Socket.IO Cookies Parser help us handle cookie for Socket.IO

Note: After setup success, socket.request.cookies was parsed to JSON object.

Functions:

/**
 * @method namespaceCookieParser setup socket midleware for namespace instance
 * @param socket Socket
 */
function namespaceCookieParser(socket: Socket): void;
/**
 * @method ioCookieParser setup socket midleware for io instance
 * @param socket Socket
 * @param next (err?: ExtendedError | undefined) => void
 */
function ioCookieParser(socket: Socket, next: (err?: ExtendedError | undefined) => void): void;

Example:

//ES6
import socketio from "socket.io";
import { namespaceCookieParser, ioCookieParser } from "socket.io-cookies-parser";
...
const io = new socketio.Server();
io.use(ioCookieParser);
...
const client = io.of("/client", namespaceCookieParser);
...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published