Socket
Socket
Sign inDemoInstall

session-socket

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

session-socket - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

2

package.json
{
"name": "session-socket",
"version": "0.0.1",
"version": "0.1.0",
"description": "The Socket.io session/user management library",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -6,3 +6,3 @@ # Session-Socket

- It's simple. Through an expressive API, session-socket makes it easy to manage and keep track of active websocket connections.
- It's intuitive. Through it's expressive API, session-socket makes it easy to manage and keep track of active websocket connections.
- It's extensible. Write custom user/session related plugins for the library.

@@ -33,8 +33,8 @@ - It's lightweight. After removing whitespace, this library sits in at just 50 lines of code.

{
all(),
get(),
toArray(),
length(),
connect(),
disconnect()
.all(),
.length(),
.get(),
.toArray(),
.connect(),
.disconnect()
}

@@ -169,6 +169,7 @@ ```

{
rooms(),
roomList(),
joinRoom(),
leaveRoom()
.assign(),
.rooms(),
.roomList(),
.joinRoom(),
.leaveRoom()
}

@@ -190,14 +191,14 @@ ```

const user = session.get(socket);
// Get user and assign some initial props:
const user = session.get(socket).assign({ city: 'Vancouver' });
// Get an object of all joined rooms:
// Assign some new properties on user:
user.assign({ id: 1, name: 'Don' });
// Get an object or array of all joined rooms:
user.rooms();
// Get an array of all joined rooms:
user.roomList();
// Join a new room:
// Join and leave a room:
user.joinRoom('chatroom1');
// Leave a room:
user.leaveRoom('chatroom1');

@@ -216,3 +217,3 @@

It's a convenience method that let's you write and store custom session/user related plugins on the library.
It's a convenience method that let's you write and store custom session/user related plugins for the library.

@@ -219,0 +220,0 @@ - This method takes 2 parameters.

@@ -5,4 +5,6 @@

this.create = (socket, obj) => {
return Object.assign(
const assign = (props) => Object.assign(_user, props);
const _user = Object.assign(
{
assign,
rooms: () => socket.adapter.rooms,

@@ -15,2 +17,3 @@ roomList: () => Object.keys(socket.adapter.rooms),

);
return _user;
};

@@ -17,0 +20,0 @@ return {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc