dowb58485 2018-06-04 16:33
浏览 72

在Quiz应用程序中设置计时器

I am working on a client-server application where a user logs in and has the option to play and answer questions. The user can answer as many questions as he can in 60 seconds. So, basically, I need to keep track of the timer. There are two approaches; one approach is to start and end the timer on the client and the other is to do it on the server. My questions are:

  1. If we do it on the client, then the user can somehow hack it. Also, what if the internet connection breaks? How can I handle that?

  2. If we do it on the server, then would it be right as far as performance is concerned? What if there are millions of people playing at the same time? The server would have to keep track of every users' timer and use sockets to notify them. Again what happens if the internet connection is lost? The server while sending message to all the socket channels would also have to keep track if it has received a feedback or not, if not, the server would have to retry sending the timeout message

What would be the appropriate approach here?

  • 写回答

1条回答 默认 最新

  • douxiong2999 2018-06-04 16:48
    关注

    You can use JavaScript for the timer as soon as your question page appears a timer function is called which will work for 60 sec

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器