socket.io, io is not defined (JS Error)

前端 未结 9 875
你的背包
你的背包 2021-01-03 20:33

I have just started with socket.io, its giving JS Error on client page

io is not defined

How to fix this ?

9条回答
  •  南笙
    南笙 (楼主)
    2021-01-03 20:55

    I had to do this. (For the client.)

    function setup() {
      var socket;
      socket = io.connect('http://localhost:3000');
    }
    /*
    This solved my error.
    */

提交回复
热议问题