Comments (8)
I have two different proposals for this:
- In between updates in a subscription, the client will ignore any arbitrary number of newline (
\n
) characters. These newlines may be inserted periodically by the server to keep a connection alive. - Allow "empty" update messages. Eg
Heart: beat\n\n
between real updates
My preference is (1), though I'm happy to be convinced if anyone has another idea. Otherwise I'll write up a PR.
from braid-spec.
Both options seem reasonable. I also prefer (1).
from braid-spec.
Me too. I've made this change to braid-protocol to send \n
newlines as heartbeat messages, and the client ignores any newlines between updates.
from braid-spec.
Shouldn't heartbeats be done at a transport level and not at braid level? E.g., if subscriptions are done using SSE, then you can use some hearbeat
event type. If you use Websockets, then you can use built-in heartbeats.
from braid-spec.
Shouldn't heartbeats be done at a transport level and not at braid level?
To clarify, Braid defines protocols over different transports (e.g. HTTP and WebSocket), and yes, the encoding of a heartbeat will be different on each one. In this issue we've been discussing how to encode heartbeats in the Braid-HTTP
version.
If you use Websockets, then you can use built-in heartbeats.
Good call! I hadn't realized it until you brought it up, but WebSockets do have a built-in ping/pong frame type: https://stackoverflow.com/a/46112000
This isn't exposed in the Javascript APIs for web browsers, but clients will respond to a ping with a pong if the server initiates the ping.
from braid-spec.
WebSockets built-in ping might be a problem if we care that the JavaScript client knows if the connection is still up or not.
from braid-spec.
The connection should get closed automatically by the browser when the server goes down or there’s a timeout. I guess we could speed up that timeout if we send our own ping messages. We could add a no-op update message I suppose. I’m not sure how much this matters in practice.
from braid-spec.
This has been implemented in 9651ad0. Closing.
from braid-spec.
Related Issues (20)
- Subscriptions with no immediate response HOT 2
- Add top level Patch-Type to subscriptions HOT 3
- What error code should we use when historical versions are missing? HOT 1
- Get requests with 'version' header should all appear in same section. HOT 3
- Allow 404s within a Subscription HOT 7
- Cache-Control is missing from the spec HOT 1
- Typo on braid.org HOT 1
- Subscription without payload HOT 6
- Compression or inheritence for headers
- Guidance for PUTs to legacy servers HOT 9
- Articulate the general form of Updates HOT 1
- Subscription parameters HOT 2
- Write Abstract Protocol HOT 3
- Place fields in correct IANA Registry
- Multi-ID versions used in text before they are explained HOT 2
- Difference between ignoring and rejecting an update HOT 3
- Reporting versioning-related errors
- Memento protocol HOT 3
- First-Readthrough Nitpicks HOT 3
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 braid-spec.