socket.io no communication between server and client
<p>I'm currently trying to have an angular2 frontend communicating with a node.js backend with socket.io.
The point is, I get the client connected to the server, but after that, no socket call can be successfully passed between them.
Here is a simple piece a code for the server :</p>

<pre><code>var app = require('express')();
var http = require('http');
var server = http.createServer(app);
var io = require('socket.io').listen(server);

io.on('connection', function() {
    io.emit('update');
    console.log('Connected');
});
io.on('updated', function() {
    io.emit('update');
    console.log('Updated');
});

server.listen(5000, function() {
    console.log('Listening on 5000');
});
</code></pre>

<p>... and for the component :</p>

<pre><code>import { Component } from '@angular/core';

import * as io from 'socket.io-client';

@Component({
  selector: 'main-app',
  template: `
  &lt;div&gt;
  &lt;button (click)="foo()"
           style='padding:20px; background:red; color:white'&gt;
    click me
  &lt;/button&gt;
  &lt;/div&gt;
  `
})
export class AppComponent {
  title = 'bar';
  socket = null;

  constructor() {
    let self = this;
      self.socket = io.connect('http://mysuperwebsite:5000', {
          transports : ["websocket"]
      });
      self.socket.on('update', function(data) {
        console.log(data);
      });
  }

  foo() {
    let self = this;
    self.socket.emit('updated', {});
  }
}
</code></pre>

<p>I can't get what is wrong, I guess you will ;)
Thanks for your help !</p>

<p>EDIT : Finally, the problem seemed to come from the lack of second parameter in io.emit(). Now it works, thanks you very much :)</p>