Meteor Namespace API
TheMeteor namespace provides the core API for Meteor applications on both client and server.
User Management
Meteor.userId()
Get the current user id, ornull if no user is logged in. A reactive data source.
Locus: Anywhere
Meteor.user()
Get the current user record, ornull if no user is logged in. A reactive data source.
Locus: Anywhere
object
Optional options object.
object
Dictionary of fields to return or exclude.
Meteor.user() is deprecated. Use Meteor.userAsync() instead.
Meteor.userAsync()
Asynchronously get the current user record, ornull if no user is logged in.
Locus: Anywhere
object
Optional options object.
object
Dictionary of fields to return or exclude.
Authentication
Meteor.logout()
Log the user out. Locus: Clientfunction
Optional callback. Called with no arguments on success, or with a single Error argument on failure.
Meteor.logoutAllClients()
Log out all clients logged in as the current user and logs the current user out as well. Locus: ClientMeteor.logoutOtherClients()
Log out other clients logged in as the current user, but does not log out the client that calls this function. Locus: ClientMeteor.loginWithPassword()
Log the user in with a password. Locus: Clientstring | object
required
Either a string interpreted as a username or an email; or an object with a single key:
email, username or id. Username or email match in a case insensitive manner.string
required
The user’s password.
function
Optional callback. Called with no arguments on success, or with a single Error argument on failure.
Meteor.loginWithToken()
Login with a Meteor access token. Locus: Clientstring
required
Local storage token for use with login across multiple tabs in the same browser.
function
Optional callback. Called with no arguments on success.
Connection Management
Meteor.status()
Get the current connection status. A reactive data source. Locus: Clientboolean
True if currently connected to the server.
string
Connection status: “connected”, “connecting”, “failed”, “waiting”, or “offline”.
number
Number of reconnection attempts made.
number
Estimated time of next reconnection attempt.
string
If failed, description of why.
Meteor.reconnect()
Force an immediate reconnection attempt if the client is not connected to the server. Locus: ClientMeteor.disconnect()
Disconnect the client from the server. Locus: ClientReactive State
Meteor.loggingIn()
True if a login method is currently in progress. A reactive data source. Locus: ClientMeteor.loggingOut()
True if a logout method is currently in progress. A reactive data source. Locus: ClientServer Connection
Meteor.onConnection()
Register a callback to be called when a new DDP connection is made to the server. Locus: Serverfunction
required
The function to call when a new DDP connection is established.