title: Socket IO Client in GatsbyJS doesn't work
body: <p>Hello friends I?m new here and I found with a hard issue, I have used Socket IO Client in react js without any problem, the same syntax  i used with Gatsby and I find this problem. My node js server doesn't detect when a new client has joined. </p>
  
  <p>This my script.</p>
  
  <p>React JS Component (Works)</p>
  
  <pre><code>import React, { useEffect } from 'react';
  import './App.css';
  
  // socket
  import socketIOClient from 'socket.io-client';
  
  const socketEndPoint = 'http://localhost:32/';
  
  const ioSocket = socketIOClient(socketEndPoint); 
  
  // nameSpace: public_chat
  const ns= 'public_chat';
  const salaSocket = socketIOClient(socketEndPoint + ns)
  const messageKey = 'test_message'; // Message id
  
  function App() {
    function sendMessage(){
      salaSocket.emit(messageKey, 'Prueba de mensaje desde el cliente: '+Math.random())
    }
  
    function recepMessage(){
      salaSocket.on(messageKey, (received) =&gt; {
        alert('Message: '+ received)
      })
    }
  
    useEffect(() =&gt; recepMessage() , [])
  
    return (
      &lt;div className="App"&gt;
        &lt;button style={{marginTop: '50', padding: '10px'}} onClick={sendMessage}&gt;
          Send message
        &lt;/button&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  
  </code></pre>
  
  <p>With GatsbyJS Component (not working)</p>
  
  <pre><code>import React, { useEffect } from 'react'
  import './Chat.scss'
  import { Button } from '@material-ui/core'
  import socketIOClient from 'socket.io-client'
  
  const socketEndPoint = 'http://localhost:32'
  const sala = 'public_chat'
  const salaSocket = socketIOClient(socketEndPoint + sala)
  const messageKey = 'test_message'
  
  function Chat() {
      function initSocket() {
          salaSocket.on(messageKey, received =&gt; alert('Message received: '+ received))
      }
      function sendMessage() {
          salaSocket.emit(messageKey, `Send a message to server`)
      }
      useEffect(() =&gt; {
          initSocket()
      }, [])
      return(
          &lt;div className='chat'&gt;
              &lt;Button onClick={sendMessage}&gt;send&lt;/Button&gt;
          &lt;/div&gt;
      )
  }
  
  export default Chat
  </code></pre>
  
  <p>As you see, both have the same script or the same logic about socket io usage, but I don't know why in react works and gatsbyjs not. Maybe is a bug or what's the problem?</p>
  
  <p>Server (No problem)</p>
  
  <pre><code>const express = require('express')
  const http = require('http')
  const socketIo = require('socket.io')
  const PORT = process.env.PORT || 32
  const app = express()
  
  const server = http.createServer(app)
  const io = socketIo(server, {origins: '*:*'})
  
  app.get('/', (req, res) =&gt; res.sendFile(`${__dirname}/index.html`))
  server.listen(PORT, () =&gt; console.log(`Socket runing at port: ${PORT}`))
  
  const sala = io.of('public_chat')
  const messageKey = 'test_message'
  sala.on('connection', socket =&gt; {
      console.log('New user connected', socket.id)
      socket.on(messageKey, data =&gt; {
          console.log('received: ', data)
          sala.emit(messageKey, data)
      })
  })
  </code></pre>
  
  <p>Thanks for your support :)</p>