question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use socket.io-client not work

See original GitHub issue

Found 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:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
imRainChencommented, Mar 9, 2018

Oh, i just use “const io = require(‘socket.io-client/dist/socket.io’)”

1reaction
zxc23commented, Jan 24, 2018

OK, this is extremely strange.

const io = require('socket.io-client/dist/socket.io')
// const io = require('socket.io-client/')

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found