Unable To Establish Connection Between Node.JS And React-Native (Socket.IO)

I'm new to React and Node and i'm trying to make a simple WebSocket using Socket.IO which gonna simply send greetings to all connected users and the user will respond to the server.

The Node.JS server is running on a Windows PC while the React-Native app is running on both iOS and Android devices.

Node.JS server code is the following

var app = require('express')();
var http = require('http').createServer(app);
var io   = require('')(http);
const bodyParser = require('body-parser');
const mysql = require('mysql');

const connection = mysql.createPool({
  host     : 'localhost',
  user     : 'root',
  password : 'block',
  database : 'visualpos'

// Creating a GET route that returns data from the 'users' table.
app.get('/prenotazioni', function (req, res) {
    // Connecting to the database.
    connection.getConnection(function (err, connection) {

    // Executing the MySQL query (select all data from the 'users' table).
    connection.query("SELECT Data, Importo_Doc FROM tabella_pagamenti", function (error, results, fields) {
      // If some error occurs, we throw an error.
      if (error) throw error;

      // Getting the 'response' from the database and sending it to our route. This is were the data is.

app.get('/', function(req, res){
  res.send('<h1>Hello World</h1>');

// Starting our server.
http.listen(3000, () => {
 console.log('In ascolto sulla porta *:3000');

io.emit('saluta', 'Ciao dal server :)');
io.on('connected', (data) => {

Actually GET part of the code works perfectly but the Socket.IO seems death. The client doesn't get any response and server the same i think the Socket.IO server simply doesn't start..

In XCode Debug i get the following errors when the app is running on the iPhone

enter image description here

And i even get on both devices warning "Unrecognized WebSocket connection option(s) 'agent', 'perMessageDeflate',..."

And here is the code i'm using in React-Native

import io from ''

    var socket = io('', {
        jsonp: false,
        transports: ['websocket'],
        autoConnect: true,
        reconnection: true,
        reconnectionDelay: 500,
        reconnectionAttempts: Infinity

     socket.on('saluta',(data) => { alert(data); });


On getStarted section, they use a "connection" event instead of "connected" (

io.on('connection', function(socket){
  console.log('a user connected');
  socket.on('disconnect', function(){
    console.log('user disconnected');