"Peer-to-peer" Live Sports Reporting and Statistics

Flow of Information

Client-serve interaction

  • A client connects to the server and identifies.
  • If its identification is accepted, it can search for an event.
  • If the event exists, it is given the address of a peer to connect to and a token to identify with.
  • If the event does not exist, it can create an event, registering it with the server.

"Peer-peer" interaction

  • A peer connects to another peer, sends its identification token.
  • If the token is accepted, the hosting starts accepting timeline events.
  • Every timeline event is voted on depending on how many peers sent it in.
  • Accepted timeline event is sent to all peers, internal timeline is updated with it.

"Peer-to-peer" Implementation

    +----------------+
    |     Server     |
    |                |-----------------------------------+
    | Identification |                                   |
    |  Event Search  |                                   |
    +----------------+                                   |
             |                                           |
             |  Identify with server                     |
             |  Search for event, connect to other peer  |
             |  Or create event, register it with server |
             |                                           |
+------------------------+          +------------------------+
|      Client (peer)     | Timeline |      Client (peer)     |
|                        |  events  |                        |
|       Host event       |----------|       Host event       |
|    Takes in events     |          |    Takes in events     |
| Votes on correct event |          | Votes on correct event |
+------------------------+          +------------------------+

Interface

The interface is separated into two parts:

  • The first part is made up of buttons representing the timeline events that can take place.
  • The second part is the feed of events that have come in, updated from the server peer.

Protocol

A message between clients will be a Json object, describing an event and identifying the sending client:

  • Type (type): type of protocol being used
  • Timestamp (time): time of sending
  • Token (token): token to identify with (checks validity)
  • Event (event): event that took place
    • Event Title (title): title of the event
    • Event Origin (origin): what made the event (for example a team)
    • Event Time (time): time that the event took place (might be earlier than when object was sent)
{
    "time": <timestamp>,
    "token": <uuid>,
    "event" {
        "type": "event",
        "title": <string>,
        "origin": <string>,
        "time": <timestamp>
    }
}

The titles of the available events will be sent to the client on the first connection, in a simple array of strings:

{
    "type": "setup",
    "origins": [ <string>* ],
    "actions": [ <string>* ]
}

Built With

Share this project:

Updates