1.0.1 • Published 4 years ago

socket.io-laravel v1.0.1

Weekly downloads
35
License
MIT
Repository
github
Last release
4 years ago

socket.io-laravel

Socket.IO middleware for interoperation with Laravel.

Example

const http = require("http");
const io = require("socket.io");
const {session} = require("socket.io-laravel");
const httpServer = http.createServer();
const socketServer = io(httpServer);
const appKey = "..."        // Laravel application encryption key

// setup middleware
socketServer.use(session(appKey, async id => {
    // load session data from storage and resolve
})));

// middleware adds .session to socket.request object
socketServer.sockets.on("connect", socket => {
    console.log(socket.request.session);
});

API

session(key, cookieName, fetch, console) => function

Create Socket.IO middleware to load Laravel session data. The key must match the Laravel app.key. The fetch function takes a string session id and should return a Promise that resolves to the session data. If a console object is provided, logs will be written to it.

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-beta1

4 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.5

6 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago