socket.io.js not found on client

后端 未结 2 1169
情书的邮戳
情书的邮戳 2021-01-23 03:10

This question has been asked previously but haven\'t found any solution in prior replies.

Socket.IO gives me two problems:

  1. server side gave this error - ER
2条回答
  •  一个人的身影
    2021-01-23 03:27

    The client file that you need is located inside the node_modules folder here:

    node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js
    

    Socket.io should serve this file though so you don't need to copy it somewhere else. For example if you are running your socket.io server on:

    http://localhost:5000
    

    Then the script will be served from:

    http://localhost:5000/socket.io/socket.io.js
    

    If you are consuming socket.io from another application or another port the relative URL in your code example won't work. You'll want to include the client-script manually or try including the client node module (if consumed by node app).

    You can view the client repository here for more info: https://github.com/LearnBoost/socket.io-client

提交回复
热议问题