实时计分 [英] Realtime Scoring

查看:103
本文介绍了实时计分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个实时评分网站.我碰到了一堵砖墙,关于我应该如何在一页上显示我的游戏记分板.我想使用jquery/javascriptJSON文件中提取数据并从中创建多个表.

I am working on creating a realtime scoring site. I've ran into a brick wall about how I should display my games scoreboard on one page. I want to use jquery/javascript to pull data from a JSON file and create multiple tables from it.

这是我的JSON文件的内容.

{"basketball_scores":[
    ["basket001","15","12","7","34","10","12","4","26"],
    ["basket002","10","15","5","30","5","10","5","20"],
    ["basket003","3","4","2","9","4","6","10","20"],
    ["basket004","2","6","2","10","5","3","4","12"]
]}

我希望能够创建4个表来自动填充每个游戏中的行和列.

I want to be able to create 4 tables that auto populate rows and column from each game.

这是我想显示的方式:

matchup  half1  half2  ot  final 
home     15     12     7   34 
away     10     12     4   26

那将是一张桌子.我想在其他领域继续这样做.

That would be one table. I would like to continue this for the rest of the field.

游戏数未知,我仅以4个为例.

The number of game is unknown i've just used 4 as an example.

推荐答案

Ajax轮询不是实时的.实时是指数据库中发生某些更改时,将该数据推送到网站,网页或其他任何内容中.

Ajax polling is not realtime. Realtime is when something changes in you database, push that data into website, web page or whatever.

  1. 某些脚本接收新数据
  2. 您将数据插入db
  3. 您将数据推送到页面

为此您需要 Strophe库和一些

you need Strophe library for this and some php XMPP class if you are using php. Every other language also have libraries for manipulating xmpp messages.

当然,说起来容易做起来容易. 这是此米上的嘘声 k. 如果您正在寻找完整的解决方案,请跳过我所说的所有内容.

Of course this is easier said then done. This is the book on this metter. If you are looking for finished solution then skip all that I said.

这篇关于实时计分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆