Comments (5)
Selfishly, I'd love to be able to use UUIDs, but that may be overkill. In either case, we're not talking about a massive amount of overhead (3 vs 4 bytes, or 3 vs 16 bytes for UUID). I'm still not 100% sure how the request IDs should be generated, but I'd definitely want to avoid collisions.
from gotalk.
Using UUIDs sounds like a good idea. Not having collisions over long periods of time over different communication channels can open unexpected possibilities.
from gotalk.
TL;DR: 3 bytes (16 777 216 values) is enough.
3 bytes is simply enough for anything I could imagine. If you have an application which might send more than 16 777 215 requests in between a request being sent and responded to, you might want to use two or more connections (one for the very very slow requests and one for the very high-frequency requests.)
The ID has the potential to express 16 777 216 values, while the current Go and JS implementations only use 46 655 values (base-36 encoded integer.) UUID does not only require a large number of bytes to be represented, it is also expensive to calculate (needs a pool of true random data, etc.) Incrementing an integer is very cheap and easy to implement.
Is there a scenario you have in mind where an application might perform 16 777 216 requests in such a close succession that the first request does not have time to complete before the 16 777 217th request is sent?
from gotalk.
46655 certainly not enough. Use at least base64 if you wish to use text only id.
Lets calc: 1000000rps of light requests and 1 request which lasts 17 seconds - then 16M will not be enough either. Yes, it is strange combination, but 4 bytes is 256 times more reliable.
from gotalk.
v1 landed in master and the protocol now uses 4 bytes for requestID
from gotalk.
Related Issues (10)
- Possible Notification discrepancy HOT 1
- [gotalk.js] Uncaught ReferenceError: s is not defined HOT 1
- Is this project maintained? HOT 2
- Any Plans to add clustering? HOT 1
- Heartbeat panics when connection is lost
- Gotalk connection close is called after 30 seconds
- Add an example with encrypted connections. HOT 7
- Protocol test suite HOT 2
- gotalk/js: exit status 3221225725 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gotalk.