Where is the socket.io client library?

后端 未结 8 1622
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 23:40

As far as I have seen, there is no explanation as to where we are to locate the client side script for socket.io if node.js is not used as the web

8条回答
  •  自闭症患者
    2020-12-14 00:05

    I used bower as suggested in Matt Way's answer, and that worked great, but then the library itself didn't have its own bower.json file.

    This meant that the bower-main-files Gulp plugin that I'm using to find my dependencies' JS files did not pull in socket.io, and I was getting an error on page load. Adding an override to my project's bower.json worked around the issue.

    First install the library with bower:

    bower install socket.io-client --save
    

    Then add the override to your project's bower.json:

    "overrides": {
      "socket.io-client": {
        "main": ["socket.io.js"]
      }
    }
    

提交回复
热议问题