REQUIREMENTS for NPush Module
-
MongoDB
Default mongo installation and you need to create dedicated schema:
1.1 Accounts collection
Name of collection: accounts Single document schema per client/user: { "apps" : [ { "apis" : [ { "name" : "api 1", "id" : ObjectId( "50ae010ab19160bb1d010000" ) }, { "name" : "api 2", "id" : ObjectId( "50ae010ab19160bb1d010001" ) } ], "application_id" : "1", "dscr" : "first application", "id" : ObjectId( "50ae0106b19160bb1d000000" ), "name" : "application 1" }, { "apis" : [ { "name" : "api 1", "id" : ObjectId( "50ae010ab19160bb1d010002" ) }, { "name" : "api 2", "id" : ObjectId( "50ae010ab19160bb1d010003" ) } ], "application_id" : "2", "dscr" : "second application", "id" : ObjectId( "50ae0106b19160bb1d000001" ), "name" : "application 2" } ], "client_room" : "localhost", "dscr" : "localhost", "name" : "localhost", "password" : "localhost", "username" : "localhost" }
1.2 APIs collection
Name of collection: apis Single document schema per api: { "enabled" : "true", "key" : "50ae010ab19160bb1d010000", "client" : "50adfdfeb19160a41d000000", "time" : 1355310922 }
1.3 Also you have to pass mongodb setting to the worker instance:
{ 'MongoDB' : { 'url' : "user:pass@localhost:27017/ni_sockets", 'collections' : ["accounts", "apis"] }, }
To manage clients, application and apis it is highly recommended to use "npush-admin" project.
-
RedisServer
Default installation. If you want to use own PORT and HOST address then pass this settings to worker instance:
{ 'RedisServer' : { 'redisClient' : { 'port' : 6379, 'host' : 'localhost'} }, }
-
Example
To run example you need mongoDB with right schema and Redis working.
Steps:
- Copy example folder outside npush module
- Go to the folder
- $ npm install
- $ node npush-s.js 8080 4
Have fun!