D
D
Doclassif02021-11-08 12:50:08
Socket.io
Doclassif0, 2021-11-08 12:50:08

socket.io Uncaught TypeError: io is not a function?

Here is the code
All installed

import Echo from "laravel-echo"

 window.io = require('socket.io-client');
 
 window.Echo = new Echo({
     broadcaster: 'socket.io',
     host: window.location.hostname + ':6001'
 });


Doesn't work, what's the problem?
Uncaught TypeError: io is not a function
at SocketIoConnector.connect (app.js:7285)
at new Connector (app.js:6278)
at SocketIoConnector. (app.js:6247)
at new SocketIoConnector (app.js:7266)
at Echo.connect (app.js:7550)
at new Echo (app.js:7524)
at Module../resources/js/bootstrap.js (app.js:26893)
at __webpack_require__ (app.js:20)
at Object../resources/js/app.js (app.js:26856)
at __webpack_require__ (app.js:20)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question