Attaching client data to the server connection


#1

I’m thinking of making a package out of this, and wondering whether anyone has feedback on how this is being done – via a method on page load and DDP.onReconnect:

# client
Meteor.call 'attachData', localStorage.getItem 'clientData'

Meteor.connection.onReconnect ->
  Meteor.call 'attachData', localStorage.getItem 'clientData'

setTimeout ->
  Meteor.call 'logData'
, 1000

# server
Meteor.methods
  attachData: (data) ->
    this.connection.data = data

  logData: ->
    console.log this.connection.data

This seems to be working, but I’m unfamiliar with this.connection. Given this setup, will this.connection.data always be there? Should I be using Meteor.connection or Meteor.default_connection?


#2

@mizzao thought you might be familiar with this?