0

I know that MeteorJS is an "isomorphic" web framework, which to my understanding means that code can run on both the client and server in different ways.

However, "server" here means a central server for all clients. If I'm making a quiz webapp, however, I need a central computer (for example to display the questions) to act as the "server" for a bunch of other clients. As in, using the quiz example, in a classroom setting, the student's computers would be clients and the teacher's computer the server.

Is this possible using Meteor? Can I deploy the same app but have it act differently depending on some setting or something?

naiveai
  • 590
  • 2
  • 14
  • 42
  • You can have it behave differently for privileged accounts (such as the teacher's). Unless you intend to have the students' computers connect directly to the teacher's, make the data for some views limited to only certain accounts and display it as necessary (e.g, a question view for the teacher's account). Otherwise, please clarify your use of "server" and "client", as it does not match the conventional use of those terms in this context. – MasterAM Jun 15 '16 at 07:52

1 Answers1

1

What you ask for is quite possible. The most common way to achieve it is by using account roles: special privileges for some users. For example, if the teacher logs in (from any computer) the app would display the admin dashboard. alanning:roles is the de facto standard package for this purpose.

You could also possibly implement this by matching the IP address of the browser and the server, too. this.connection will tell you the client IP inside Meteor methods and publications, and Node.js can tell you the server IP. This way you don't need user accounts at all, but then all clients must connect to the teachers computer.

I'd go with account roles, I believe it's more reliable than comparing IP addresses.

Community
  • 1
  • 1
aedm
  • 5,596
  • 2
  • 32
  • 36
  • But you cannot run code at both the children's computer and the teacher's computer at the same time, which is how Meteor does it with regular client-server. – naiveai Jun 16 '16 at 06:35
  • Of course you can. The teachers computer runs the Meteor server and the client (in a browser), and the students computers only run the client. – aedm Jun 16 '16 at 09:37