Meteor.onConnection is missing on browser

METEOR@1.6.1.1

I was to find client IP address, and I found this method, but when I use it as below, browser returns error such as “Meteor.onConnection is not a function”

import { Meteor } from "meteor/meteor"
Meteor.onConnection(function(c) {
  console.log(c)
})

console.log(Meteor)

gives https://i.gyazo.com/4da3ae1feafe8b611ab5febc0b6d3d7f.png and it actually doesn’t have onConnection method.

Am I doing anything wrong?

It’s not as clear as it should be in the docs, but Meteor.onConnection is a server only method

1 Like