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.

Using with socket.io and express

See original GitHub issue

I’m having an issue:

  • Give an expressive description of what is went wrong Starting an ExpressPeerServer in a server that runs express and socket.io breaks socket.io. Apparently both use the same port and this wrecks havoc, but this used to work with previous versions.

  • Version of peer you’re experiencing this issue 0.5.3

  • Nodejs version? v10

  • Platform name and its version (Win, Mac, Linux)? Linux. Also, socket.io 2.3.0.

  • Nice to have: a repository with code to reproduce the issue Sorry, don’t have

  • If you’re getting an error or exception, please provide its full stack-trace as plain-text or screenshot There’s no error. socket.io starts, but app.use('/peerjs', peerserverSSL); breaks socket.io connections.

This used to work with "peerjs-server": "^0.2.9", but broke after updating to current.

Is this a bug or is peerjs now incompatible with socket.io? If incompatible, any suggestions for a workaround? Create a new peerjs server without using express perhaps? Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
brunobgcommented, Aug 12, 2020

so if anyone runs into this: no, you cannot run with express and socket.io at the same time. peerjs now seems to use the same websocket attachment to express than socketio. run a separate peerserver.

3reactions
brunobgcommented, Oct 13, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Get started - Socket.IO
In this guide we'll create a basic chat application. It requires almost no basic prior knowledge of Node.JS or Socket.IO, so it's ideal...
Read more >
Integrate Socket.IO with Node.Js + Express | Medium
Socket.IO is a JavaScript library for real-time web applications. It enables real-time, bi-directional communication between web clients and ...
Read more >
Creating an Express server with Socket.IO - Packt Subscription
Socket.IO can be used based on the Express server just as easily as it can run on a standard Node HTTP server. In...
Read more >
Using socket.io in Express 4 and express-generator's /bin/www
Here is how you can add Socket.io to a newly generated Express-Generator application: Create a file that will contain your socket.io logic, ...
Read more >
Building a real-time web app in NodeJS Express with Socket ...
Server-Side Implementation of Socket.io. For starters, within an Express NodeJS web app, the server-side of the code conventionally refers ...
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