All Projects → Meteor-Community-Packages → Meteor Timesync

Meteor-Community-Packages / Meteor Timesync

Licence: mit
NTP-style time synchronization between server and client, and facilities to use server time reactively in Meteor applications.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Meteor Timesync

Meteor Publish Composite
Meteor.publishComposite provides a flexible way to publish a set of related documents from various collections using a reactive join
Stars: ✭ 546 (+374.78%)
Mutual labels:  hacktoberfest, meteor
Meteor Collection Hooks
Meteor Collection Hooks
Stars: ✭ 641 (+457.39%)
Mutual labels:  hacktoberfest, meteor
Meteor Autocomplete
Client/server autocompletion designed for Meteor's collections and reactivity.
Stars: ✭ 352 (+206.09%)
Mutual labels:  hacktoberfest, meteor
Meteor Partitioner
Transparently divide a single meteor app into several different instances shared between different groups of users.
Stars: ✭ 153 (+33.04%)
Mutual labels:  hacktoberfest, meteor
Meteor Files
🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
Stars: ✭ 1,033 (+798.26%)
Mutual labels:  hacktoberfest, meteor
Meteor Roles
Authorization package for Meteor, compatible with built-in accounts packages
Stars: ✭ 916 (+696.52%)
Mutual labels:  hacktoberfest, meteor
Meteor User Status
Track user connection state and inactivity in Meteor.
Stars: ✭ 555 (+382.61%)
Mutual labels:  hacktoberfest, meteor
Uniforms
A React library for building forms from any schema.
Stars: ✭ 1,368 (+1089.57%)
Mutual labels:  hacktoberfest, meteor
Meteor Collection2
A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
Stars: ✭ 1,020 (+786.96%)
Mutual labels:  hacktoberfest, meteor
Rocket.chat
The communications platform that puts data protection first.
Stars: ✭ 31,251 (+27074.78%)
Mutual labels:  hacktoberfest, meteor
Vulcan
🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
Stars: ✭ 8,027 (+6880%)
Mutual labels:  hacktoberfest, meteor
Meteor
Meteor, the JavaScript App Platform
Stars: ✭ 42,739 (+37064.35%)
Mutual labels:  hacktoberfest, meteor
U Root
A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.
Stars: ✭ 1,816 (+1479.13%)
Mutual labels:  hacktoberfest
Goodwork
Self hosted project management and collaboration tool powered by TALL stack
Stars: ✭ 1,730 (+1404.35%)
Mutual labels:  hacktoberfest
Lemmur
🐒 A mobile client for lemmy
Stars: ✭ 114 (-0.87%)
Mutual labels:  hacktoberfest
Graphql Live Query
Realtime GraphQL Live Queries with JavaScript
Stars: ✭ 112 (-2.61%)
Mutual labels:  hacktoberfest
Pssharedgoods
PSSharedGoods is little PowerShell Module that primary purpose is to be useful for multiple tasks, unrelated to each other. I've created this module as “a glue” between my other modules.
Stars: ✭ 115 (+0%)
Mutual labels:  hacktoberfest
React Most Wanted
React starter kit with "Most Wanted" application features
Stars: ✭ 1,867 (+1523.48%)
Mutual labels:  hacktoberfest
Competitive Programming
Hello Programmers 💻 , A one-stop Destination✏️✏️ for all your Competitive Programming Resources.📗📕 Refer CONTRIBUTING.md for contributions
Stars: ✭ 113 (-1.74%)
Mutual labels:  hacktoberfest
Invoke Zerologon
Invoke-ZeroLogon allows attackers to impersonate any computer, including the domain controller itself, and execute remote procedure calls on their behalf.
Stars: ✭ 100 (-13.04%)
Mutual labels:  hacktoberfest

meteor-timesync Build Status

NTP-style time synchronization between server and client, and facilities to use server time reactively in Meteor applications.

What's this do?

Meteor clients don't necessarily have accurate timestamps relative to your server. This package computes and maintains an offset between server and client, allowing server timestamps to be used on the client (especially for displaying time differences). It also provides facilities to use time reactively in your application.

There is a demo as part of the user-status app at http://user-status.meteor.com.

Installation

meteor add mizzao:timesync

Usage

  • TimeSync.serverTime(clientTime, updateInterval): returns the server time for a given client time, as a UTC/Unix timestamp. A reactive variable which changes with the computed offset, and updates continually. Pass in clientTime optionally to specify a particular time on the client, instead of reactively depending on the current time. Pass in updateInterval to change the rate (in milliseconds) at which the reactive variable updates; the default value is 1000 (1 second).
  • TimeSync.serverOffset(): returns the current time difference between the server and the client. Reactively updates as the offset is recomputed.
  • TimeSync.roundTripTime(): The round trip ping to the server. Also reactive.
  • TimeSync.isSynced(): Reactive variable that determines if an initial sync has taken place.
  • TimeSync.resync(): Re-triggers a sync with the server. Can be useful because the initial sync often takes place during a lot of traffic with the server and could be less accurate.
  • TimeSync.loggingEnabled: defaults to true, set this to false to suppress diagnostic syncing messages on the client.

To use the above functions in a non-reactive context, use Deps.nonreactive. This is useful if you are displaying a lot of timestamps or differences on a page and you don't want them to be constantly recomputed on the client. However, displaying time reactively should be pretty efficient with Meteor 0.8.0+ (Blaze).

Note that TimeSync.serverTime returns a timestamp, not a Date, but you can easily construct a date with new Date(TimeSync.serverTime(...)).

You can also use something like TimeSync.serverTime(null, 5000) to get a reactive time value that only updates at 5 second intervals. All reactive time variables with the same value of updateInterval are guaranteed to be invalidated at the same time.

Notes

  • This library is a crude approximation of NTP, at the moment. It's empirically shown to be accurate to under 100 ms on the meteor.com servers.
  • We could definitely do something smarter and more accurate, with multiple measurements and exponentially weighted updating.
  • Check out the moment library packaged for meteor for formatting and displaying the differences computed by this package.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].