Closed gzg1500521074 closed 4 years ago
import VueSocketIOExt from 'vue-socket.io-extended' import io from 'socket.io-client' const socket = io('http://127.0.0.1:3000',{ transports: ['websocket'], autoConnect:false, debug: true, query:{ name: "guozg" }, transportOptions: { polling: { extraHeaders: { Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV" } } } }) Vue.use(VueSocketIOExt, socket)
give up set header
import VueSocketIOExt from 'vue-socket.io-extended' import io from 'socket.io-client' const socket = io('http://127.0.0.1:3000',{ transports: ['websocket'], autoConnect:false, debug: true, query:{ name: "guozg" }, transportOptions: { polling: { extraHeaders: { Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV" } } } }) Vue.use(VueSocketIOExt, socket)