This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27915 - Clients of WebSockets are not NTP synced (and there is no NTP-alike spec)
Summary: Clients of WebSockets are not NTP synced (and there is no NTP-alike spec)
Status: RESOLVED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebSocket API (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-28 07:00 UTC by cmartensms
Modified: 2015-10-01 21:26 UTC (History)
4 users (show)

See Also:


Attachments

Description cmartensms 2015-01-28 07:00:23 UTC
All major browsers (Chromium, Opera, Firefox, IE) have problems when being used in realtime networking applications.

Date.now() inside the browser is not synced with NTP, therefore clients can gain access to systems when they reset their clock to a previous date when WebRTC or WebSockets are used peer-to-peer.

I think we need desperately a WebSocket extensions spec that can be implemented in order to sync the network connection with a heartbeat and tick(-ack).

From a developer perspective, I can't believe nobody had the issue before. There are also no libraries available, which seems surreal as there are thousands of users of Socket.IO and other WebSocket libraries where all the libraries depend on a synced clock as they are using Date.now() etc.


My questions so far are:
- Why are browsers not synced with NTP in the background?
- Why is there no WebSocket extension spec that implements an NTP-like behaviour?
- How to overwrite the behaviour of Date.now(), it is pretty much bad approach to do so?
Comment 1 Ian 'Hixie' Hickson 2015-01-29 23:05:52 UTC
Browsers rely on the system clock. Most (all?) systems I deal with these days have system clocks driven by NTP. What systems don't?

You can presumably layer NTP-like behaviour on top of a combination of WebSocket and WebRTC. This doesn't seem like something that need be baked into the protocol (just like it's not baked into TCP or UDP).

You can replace Date.now by saying:

   Date.now = function () { ... }

Indeed you can replace Date entirely if you like.
Comment 2 Domenic Denicola 2015-10-01 21:26:36 UTC
Markings as resolved per comment 1's

> Browsers rely on the system clock. Most (all?) systems I deal with these days have system clocks driven by NTP. What systems don't?

and

> You can replace Date.now by saying:

Let us know if you disagree and we can reopen.