socket.io - ReferenceError: io is not defined

后端 未结 8 1574
再見小時候
再見小時候 2020-12-02 13:11

I am writing an application for Android 2.3.5 (that will also be compatible with iOS). I wish to transfer data from the app\'s HTML/Javascript to a Python program on a serve

8条回答
  •  抹茶落季
    2020-12-02 13:55

    When getting socket.io to work with many other libraries using require.js I had same error, it turned out to be caused because of trying to load the socket.io.js file from the same /js folder than the rest of the other files.

    Placing it in a separated folder, fixed it for me, you can see the code in this gist but all I changed for making it work, was this:

    instead of:

    socketio: 'socket.io',

    Use:

    socketio: '../socket.io/socket.io',

    Not sure about the reason of this behavior, but I hope it helps you.

提交回复
热议问题