Coinigy / sc-presence

Socket Presence Module for SocketCluster
12 stars 4 forks source link

I'm getting a weird error on startup. #1

Open happilymarrieddad opened 8 years ago

happilymarrieddad commented 8 years ago

I'm getting a weird error on startup. Thanks!

Presence System Starting with the following config:

{ scpGcWorkerId: 0,
  scpGcInterval: 60,
  scpGcThreshold: 120,
  scpBlockUsercountThreshold: 60,
  scpSCPingsPerUpdate: 6,
  scpUsercountChannel: 'USERCOUNT',
  scpUsercountType: 'USERS',
  scpPresenceChannel: '_SCPRESENCE',
  scpDbhost: 'localhost',
  scpDbname: 'fusion',
  scpDbTablename: 'scp_users',
  scpDbuser: 'love_to_give_db_login_info_online',
  scpDbpassword: 'of_course_i_would_put_my_password_online_for_all_to_see',
  scpConnectUpdateDelay: 3000,
  scpUserIdField: 'user_id' }

 Presence System Running.
1459528012353 - Worker 6 was respawned
1459528023291 - Origin: Worker (PID 15999)
   [Error] TypeError: next is not a function
  at Object.<anonymous> (/home/nick/Projects/Nodejs/fusion/node_modules/sc-presence/sc-presence.js:115:13)
  at /home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:1165:24
  at iterate (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:262:13)
  at async.forEachOfSeries.async.eachOfSeries (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:281:9)
  at Object.<anonymous> (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:1164:24)
  at Object.<anonymous> (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:166:37)
  at Object.<anonymous> (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:1170:27)
  at Object.applyEachSeries (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/async/lib/async.js:167:37)
  at EventEmitter.SCServer._passThroughMiddleware (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/socketcluster-server/scserver.js:584:15)
  at EventEmitter.SCServer.verifyInboundEvent (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/socketcluster-server/scserver.js:546:8)
  at WebSocket.<anonymous> (/home/nick/Projects/Nodejs/fusion/node_modules/socketcluster/node_modules/socketcluster-server/scsocket.js:85:23)
bberzinskas-tw commented 7 years ago

same..

robborden commented 7 years ago

There is a minor change needed for version 4+ of SocketCluster. I haven't been able to make this change yet but the middleware passes in just a request object and a callback now, whereas previously it sent in several different values. Now those same values are in the request object instead. I can offer more assistance if you wish to fix the problem yourself before I can get to it.

nagamanojv commented 7 years ago

Hi @robborden I am stuck with the same error. Could you please assist me on how to fix it.

nagamanojv commented 7 years ago

Hi @robborden , never mind, I modified the sc-presence.js from lines 113 - 116 as follows and it is working now :)

worker.scServer.addMiddleware(worker.scServer.MIDDLEWARE_SUBSCRIBE, function (req, next) { module.exports.subscribeUser(req.socket, req.channel, function (err) { if (err) console.log(err); }); next(); });

happilymarrieddad commented 7 years ago

@nagamanojv Hey man are you going to make a pull request?

nagamanojv commented 7 years ago

@happilymarrieddad I don't think I can as I don't have permission to create a branch in this repository

happilymarrieddad commented 7 years ago

@nagamanojv fork the repo, make your changes, push up to your github account, login to github, go to the pull requests on your account and your repo, click on the "Make Pull Request" and then just select this repo as the master and yours and the one to pull from.

robborden commented 7 years ago

Hi @nagamanojv

If you submit a PR I will make sure this fix is merged. This issue is the result of a change they made between v2 and v4. Thank you for fixing!