-1

I have deployed a simple javascript memory game to heroku with lite-server. https://happy-birthday-eline.herokuapp.com

To my surprise, when a user turns a card, all other users see the card turn too. I can't figure out why. I thought client-side actions were limited to the client and could in no way update the server or impact other users. How do I prevent a user action (click on card) from propagating to all other users? Thanks

Answer: I thought I could just deploy using lite-server (rather than express) but lite-server has file listening enabled, which is why user actions were impacting all other users. (Obvious) solution was to use express on Heroku, not lite-server!

SamHeyman
  • 207
  • 3
  • 13

1 Answers1

0

It's caused by BrowserSync. Looks like you deployed a development version of your code and BrowserSync is connected.

In order to avoid it, you have to deploy a production version of your application.

Sergey
  • 450
  • 4
  • 12
  • Thanks Sergey for your quick reply. That sounds like the probable reason. First time using BrowserSync. Let me try and I'll update the question if it works. – SamHeyman Jul 27 '19 at 10:50
  • Ok I installed express and added a server.js script and all works as expected now. Thanks again for pointing me in the right direction! I thought I could get away with using lite-server but I was proven wrong :-) – SamHeyman Jul 27 '19 at 11:28