Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing socket.io with uwebsockets for better latency/performance? #98

Open
MaZZly opened this issue Oct 3, 2018 · 7 comments
Open

Comments

@MaZZly
Copy link

MaZZly commented Oct 3, 2018

Hi,

First of all, awesome framework! Finally gotten started writing a game I've wanted to make for like 3 years.

I was researching today about scalability of server nodes and stumbled upon this interesting reddit thread:
https://www.reddit.com/r/gamedev/comments/6gjgnx/backend_scaling_for_multiplayer_html5_games/

There they mention that socket.io is not so good and mention that uwebsockets is performing better.

Could this maybe be something worth considering for the websocket communications?

@namel
Copy link
Member

namel commented Oct 5, 2018

Hi MaZZly

Good luck with your game. uwebsockets sounds interesting, and thanks for pointing me to that reddit thread.

Truth is that I want to move towards UDP, which probably means dropping websockets altogether. This is what non-javascript (i.e. real) games use, and provides a much better experience. However last time we checked UDP was still tricky to use in node-js environments.

It's very high on the wish-list...

@MaZZly
Copy link
Author

MaZZly commented Oct 8, 2018

Yeah ofc better latency is always a plus (as long as it also scales)

Have you checked out https://www.npmjs.com/package/wrtc ? Seems to be handling WebRTC with node?

  • Not sure how much it can handle tho, thinking of scalability.

This might be interesting if you are starting to write the client-server handling with WebRTC:
http://blog.brkho.com/2017/03/15/dive-into-client-server-web-games-webrtc/


Found this thread that boasts quite nice numbers for uWS: socketio/engine.io#388

I was mostly interested in the uWS vs socket.io because there seems to be a benefit CPU-load wise.. And swapping it out doesn't seem like it should be too much work? as uWS was written to be easy to plug in.

@OpherV
Copy link
Member

OpherV commented Nov 29, 2018

@MaZZly The problem is that there are no good node-server based implementation for WebRTC, especially ones that implement unreliable data channels properly. WebRTC in itself was designed to work peer-to-peer rather than with server-client star topology

@MaZZly
Copy link
Author

MaZZly commented Jan 31, 2019

So while waiting for something good along the lines of WebRTC to come along, maybe uWebSockets could be put in place?
https://github.com/uNetworking/uWebSockets.js

@richrd
Copy link

richrd commented Feb 2, 2019

UDP is sure the way to go, but hard to do in browsers. One question though: why not just use vanilla js websockets instead of uwebsockets / socket.io / or any other wrapper?

@ouya99
Copy link

ouya99 commented Feb 2, 2020

I tested http://geckos.io/ . It does WebRTC with UDP channels

Could this be used for lance?

@MaZZly
Copy link
Author

MaZZly commented Jul 7, 2020

@OpherV @namel do you have any input/comments for the above Geckos suggestion? I feel like this is quite an important part of getting a multiplayer game to run smoothly with low latencies. And now it seems it would be quite easy to implement? (hopefully) :)

The demo from the Geckos.io repo has quite a good comparison: https://www.youtube.com/watch?v=ZEEBsq3eQmg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants