Use socket.io-client not work
See original GitHub issueFound an issue or bug with electron-vue? Tell me all about it!
I want to use socket.io-client. But i found not work. I think webpack main and renderer config have error
How can I reproduce this problem?
npm install --save socket.io-client
in App.vue
import io from 'socket.io-client'
const socket = io('http://localhost/admin');
If work can connect to websocket in http://localhost/admin
Tell me about your development environment.
- Node version: v7.2.0
- NPM version: v5.5.1
- vue-cli version: (if necessary)
- Operating System: MAC
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Node js - Socket.io-client is not connecting to socket.io server
Use the same version of socket io client and server. It will work perfectly.
Read more >Troubleshooting connection issues | Socket.IO
First and foremost, please note that disconnections are common and expected, even on a stable Internet connection:
Read more >Node js - Socket.io-client is not connecting to socket.io server ...
I am trying to connect to a socket.io-client using the following code: Server: // Load requirements var http = require('http'),
Read more >socket.io-client - npm
Realtime application framework client. Latest version: 4.5.4, last published: a month ago. Start using socket.io-client in your project by ...
Read more >Everything you need to know about Socket.IO - Ably Realtime
Sockets are an open connection between a server and client. The server only knows about the clients who have connected directly with it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh, i just use “const io = require(‘socket.io-client/dist/socket.io’)”
OK, this is extremely strange.
I normally use the second line, uncommented. It pretty much never works in development. However, if I use the above code when I do
npm run dev
, then I comment the top and uncomment the bottom, it hot-reloads and works for the rest of the dev session.