我有一个套接字IO连接问题

我正在反应js和使用套接字和expression来build立一个多人游戏

我得到这个错误:

polling-xhr.js:264 GET https:// localhost:3000 / socket.io /?EIO = 3&transport = polling&t = LqjOuC2 net :: ERR_CONNECTION_CLOSED

我谷歌这个错误5倍,并调整我的import应用程序,套接字,快递和http,

Server.js

var app = require('express')(); var http = require('http').Server(app); const port = process.env.PORT || 3001; http.listen(port, ()=> {console.log("+++Express Server with Socket Running!!!")}) var io = require('socket.io').listen(http); .... .... 

前端

 import React, { Component } from 'react'; import Test from "./Test" import io from "socket.io-client" import {BrowserRouter as Router, Route, Link} from 'react-router-dom' // *********************************** // Handles user creation and contains routes to game // *********************************** class App extends Component { constructor(props){ super(props) this.home = this.home.bind(this) this.socket = io.connect("https://localhost:3000") } .... .... 

我的package.json有一个代理设置在:“ https:// localhost:3000 / ”

任何人有一个想法如何解决连接错误,任何帮助,非常感谢!