new BackendSessionService()
Service that maintains backend sessions and the communication with frontend
servers.
BackendSessionService would be created in each server process and maintains
backend sessions for current process and communicates with the relative
frontend servers.
BackendSessionService instance could be accessed by
`app.get('backendSessionService')` or app.backendSessionService.
Methods
-
bind(frontendId, sid, uid, cb)
-
Bind the session with the specified user id. It would finally invoke the the sessionService.bind in the cooperating frontend server.
Parameters:
Name Type Description frontendIdString cooperating frontend server id sidNumber session id uidString user id cbfunction callback function -
get(frontendId, sid, cb)
-
Get backend session by frontend server id and session id.
Parameters:
Name Type Description frontendIdString frontend server id that session attached sidString session id cbfunction callback function. args: cb(err, BackendSession) -
getByUid(frontendId, uid, cb)
-
Get backend sessions by frontend server id and user id.
Parameters:
Name Type Description frontendIdString frontend server id that session attached uidString user id binded with the session cbfunction callback function. args: cb(err, BackendSessions) -
kickBySid(frontendId, sid, cb)
-
Kick a session by session id.
Parameters:
Name Type Description frontendIdString cooperating frontend server id sidNumber session id cbfunction callback function -
kickByUid(frontendId, uid, reason, cb)
-
Kick sessions by user id.
Parameters:
Name Type Description frontendIdString cooperating frontend server id uidNumber | String user id reasonString kick reason cbfunction callback function -
push(frontendId, sid, key, value, cb)
-
Push the specified customized change to the frontend internal session.
Parameters:
Name Type Description frontendIdString cooperating frontend server id sidNumber session id keyString key in session that should be push valueObject value in session, primitive js object cbfunction callback function -
pushAll(frontendId, sid, settings, cb)
-
Push all the customized changes to the frontend internal session.
Parameters:
Name Type Description frontendIdString cooperating frontend server id sidNumber session id settingsObject key/values in session that should be push cbfunction callback function -
unbind(frontendId, sid, uid, cb)
-
Unbind the session with the specified user id. It would finally invoke the the sessionService.unbind in the cooperating frontend server.
Parameters:
Name Type Description frontendIdString cooperating frontend server id sidNumber session id uidString user id cbfunction callback function