0

I'm quite new to the Node.js and I currently have a problem to make mean.js + socket.io work properly.

In a nutschel, the client does not receive the events emitted in the on('connection',...) handler, but it receives other events.

To demonstrate my probleme, I reproduced it on a base mean.js application.

Steps to reproduce:

  1. install mean.js:
    npm install -g generator-meanjs
    yo meanjs

  2. Replace server.js with this one https://gist.github.com/Nihaux/c02d61f6572d6531b60c (setup socket.io)

  3. Replace app/views/layout.server.view.hmtl with this one https://gist.github.com/Nihaux/05041ff4a33f0f5c7508 (launch socket io and add a link to send an event)

  4. Optional comment line 67 in config/express.js to disable express logger (too much noise).

  5. Run DEBUG=socket* node server.js

  6. With google-chrome, open the debug bar, on the network tab, websocket filter

  7. Goto localhost:3000. The websocket should appear: on the frame tab I have 5
    3probe
    2probe
    => I should have received a "hello" msg

  8. Scroll at the bottom of the page and click on "TEST ME"
    after refreshing the frame tab (by click on another tab then back to frame tab) I can see:
    42["test:received",{"data":"test"}] ==> the message the server sent me back
    42["test"] ==> the message I sent
    5
    3probe
    2probe

Please, can anyone spot what I'm doing wrong?

EDIT: In fact the client does receive the event, but google-chrome does not shows it on the frame panel.

1 Answer 1

1

This tutorial is a pretty straightforward way to get Socket.IO integrated and working with a base MEAN.JS project. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.