Answer the question
In order to leave comments, you need to log in
TypeError: Object(...) is not a function - how to solve?
socket.js file:
import { io } from "socket.io-client";
const URL = "http://localhost:3001";
const socket = io(URL, { autoConnect: false });
socket.onAny((event, ...args) => {
console.log(event, args);
});
export default socket;
import socket from "./socket.js";
methods: {
onUsernameSelection(username){
this.usernameArleadySelected = true;
socket.auth = {username}
socket.connect()
}
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question