Is it just me or the latest server.js file is declaring the extensionsConfig properties a bit too soon in the code ? I guess we need to wait to have all the variables it use to be declared before using them ?!
So basically we should need to cut / paste this group l.114
**
* Define a configuration object to pass to all server extensions at
* initialization. The extensions do not have access to this namespace,
* so we provide them with references.
*/
var extensionsConfig = {
'publishMessageToChannel': publishMessageToChannel,
'publishMessageToClient': publishMessageToClient,
'addClientToChannel': addClientToChannel,
'settings': settings,
'channels': channels,
'io': io,
'tokenChannels': tokenChannels,
'authenticatedClients': authenticatedClients,
'request': request,
'sendMessageToBackend': sendMessageToBackend
};
just below the line 1095 :
invokeExtensions('setup', extensionsConfig);
So that :
**
* Define a configuration object to pass to all server extensions at
* initialization. The extensions do not have access to this namespace,
* so we provide them with references.
*/
var extensionsConfig = {
'publishMessageToChannel': publishMessageToChannel,
'publishMessageToClient': publishMessageToClient,
'addClientToChannel': addClientToChannel,
'settings': settings,
'channels': channels,
'io': io,
'tokenChannels': tokenChannels,
'authenticatedClients': authenticatedClients,
'request': request,
'sendMessageToBackend': sendMessageToBackend
};
invokeExtensions('setup', extensionsConfig);
Cheers !
Comments
Comment #1
Anonymous (not verified) commentedoh dear, thanks for the report.
Comment #2
julien66 commentedYou're welcome. Thank for your work.
Can I also ask why the function publishMessageToContentChanel can not be part of this object so that I could call it directly instead of going to the backend first ?
++
Comment #3
trankzen commentedThere's another problem, I'm afraid.
The invokeExtensions function is called before the io object is initialized , therefore trying to use that object in a server extension will result in a crash.
Comment #4
Anonymous (not verified) commentedi've just pushed a fix:
http://drupalcode.org/project/nodejs.git/commit/74825cae028f6ac2669eb143...
@julien66, @trankzen: please reopen if this doesn't do what you need.
Comment #6
loveye0716 commentedthank you for the report! It's working well!