0
votes

I'm a PHP developer who started learning node.js and moved on to meteor, i'm trying to use Session.set("varName", "varValue"); on the server side but i get an exception "Session not defined" but when i run that command on the console on the browser or on the code on the client side it works just fine

I know this question has been asked many times i have done tons of researches before asking

-some suggested that i do : meteor add session

-others suggested that i go to .meteor/packages and add session at the last line

-others even said that it's impossible to use session on the server side, but i really need to in my project

None of these solutions worked for me and they all were about older version of meteor, and i'm using the latest version, 1.5

I'm a PHP developer so i'm used to using session in my projects and it's very annoying that i can't use it with meteor

Any ideas how i can uses session on the server side ?

1
The Session is a reactive variable that, for historical reasons, is defined on the client. You can create a reactive var on the server and call it whatever you like, but the question is what are you trying to achieve by it. - MasterAM
ReactiveVar is the way to go on the server. - Michel Floyd
Session worked only client side. if you want server side ,please do another way of methods. Meteor call ,Method use to data transfering client side to server side vice versa .4 - Aboobakkar P S

1 Answers

0
votes

As per Meteor docs, Session is client-side only [https://docs.meteor.com/api/session.html]. If you need that functionality, check out https://github.com/matteodem/meteor-server-session however I'd suggest rethinking your application to be calling a method that passes the session value from client to server.