I have been trying to integrate node.js with Drupal 8 as I have a lot of incoming REST data and I want users to see it without hitting refresh. I followed this video https://youtu.be/znr0aFOlDnI.

I gather there is something wrong with socket that is why node is not reflecting changes on my drupal site. Please help me with the same.

I am using Drupal8 with apache and mysql . After some efforts the HTTP server started and status report showed that node.js server was successfully reached. For testing my Drupal site I hit a random url and waited for it to reflect on my dblog at the same time (as demonstrated in the video). It failed. The backend showed the error - The channel "watchdog_dblog" doesn't exist.

Here, the port used was 8888 (as per the video). It was changed to 8080 and then this error did not show up, but the drupal site still did not auto-refresh. The nodejs.config.js file currently:

settings = {
      scheme: 'http',
      port: 8080,
      host: 'localhost',
      resource: '/socket.io',
      serviceKey: 'mytest1',
      backend: {
        port: 80,
        host: 'drupal8',
        scheme: 'http',
        basePath: '',
        messagePath: '/nodejs/message'
      },
      debug: true,
      sslKeyPath: '',
      sslCertPath: '',
      sslCAPath: '',
      baseAuthPath: '/nodejs/',
      publishUrl: 'publish',
      kickUserUrl: 'user/kick/:uid',
      logoutUserUrl: 'user/logout/:authtoken',
      addUserToChannelUrl: 'user/channel/add/:channel/:uid',
      removeUserFromChannelUrl: 'user/channel/remove/:channel/:uid',
      addChannelUrl: 'channel/add/:channel',
      removeChannelUrl: 'channel/remove/:channel',
      setUserPresenceListUrl: 'user/presence-list/:uid/:uidList',
      addAuthTokenToChannelUrl: 'authtoken/channel/add/:channel/:uid',
      removeAuthTokenFromChannelUrl: 'authtoken/channel/remove/:channel/:uid',
      toggleDebugUrl: 'debug/toggle',
      contentTokenUrl: 'content/token',
      publishMessageToContentChannelUrl: 'content/token/message',
      extensions: [],
      clientsCanWriteToChannels: true,
      clientsCanWriteToClients: true,
      transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
      jsMinification: true,
      jsEtag: true,
      logLevel: 1
    };

I did not see socket.io while looking at the page source and inspect element network. After that the node.js config module was enabled but the service key field was non-editable. I then created a file nodejs.config.js in modules/nodejs and copied the configuration there. Socket.io showed up with the path localhost:8080//socket.io/socket.io.js. Even if I change the port to 8888, the socket path/port remains the same.
This is the error now cleanupSocket: Cleaning up after socket id C0I_r38wIbcT1LbtAAAD, uid undefined

Comments

shivanip created an issue. See original summary.

avpaderno’s picture

Priority: Major » Normal
Issue tags: -nodejs