Note: This was solved before posted

I'm getting this error, I realized that I had this error when I saw that node_send_user_message() wasn't working, nodejs_broadcast_message does work.

This is the full error:

Authenticating client with key "d92087d5d89f1a84529ddb078c66690b"
Sending message to backend { authToken: 'd92087d5d89f1a84529ddb078c66690b',
  messageType: 'authenticate',
  clientId: '1400251403573442393' } { uri: 'http://example.com:80/nodejs/message/',
  body: 'messageJson=%7B%22authToken%22%3A%22d92087d5d89f1a84529ddb078c66690b%22%2C%22messageType%22%3A%22authenticate%22%2C%22clientId%22%3A%221400251403573442393%22%7D&serviceKey=',
  headers: 
   { 'Content-Length': 172,
     'Content-Type': 'application/x-www-form-urlencoded' } }
Invalid login for uid " 0 "

And my config file:

backendSettings = {
  "scheme":"http",
  "host":"example.com",
  "port":8888,
  "key":"/path/to/key/file",
  "cert":"/path/to/cert/file",
  "resource":"/socket.io",
  "publishUrl":"publish",
  "serviceKey":"",
  "backend":{
  "port":80,
  "host":"example.com",
  "messagePath":"/nodejs/message/"},
  "clientsCanWriteToChannels":false,
  "clientsCanWriteToClients":false,
  "extensions":"",
  "debug":true,
  "transports":["websocket",
  "flashsocket",
  "htmlfile",
  "xhr-polling",
  "jsonp-polling"],
  "jsMinification":true,
  "jsEtag":true,
  "logLevel":1};

I tried to change some values but this is the only way the broadcast works.

I'm also having problems with the serviceKey, but as soon as I leave it empty it works.

When I try to send a message to a user I get:

Cleaning up after socket id 349663726511888346 uid undefined
publishMessage: message { data: { subject: 'Testing', body: 'testing' },
  channel: 'nodejs_user_87',
  callback: 'nodejsNotify',
  broadcast: false,
  clientSocketId: '' }
publishMessageToChannel: The channel "nodejs_user_87" doesn't exist.

Solution
In my case, the problem was that I was using mongodb_session module to store the sessions, nodejs is not compatible with mongodb, therefore it couldn't get the session and wasn't getting the uid

Comments

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.