session-socket
Advanced tools
Comparing version 0.0.1 to 0.1.0
{ | ||
"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 { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9287
56
272