Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Server Protocol #819

Merged
merged 1 commit into from
Jun 22, 2024
Merged

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Jun 22, 2024

This implements a new improved version of the server protocol. The following changes have been made:

  • The protocol is based on JSON messages. This allows for example for more structured commands where it's easier to provide multiple arguments for a command and even have optional arguments.
  • For each command, there is a corresponding response. It is either a success response with possibly the value that you requested, or an error response with an error code.
  • On top of the responses you also get sent event messages that indicate changes to the timer. These can either be changes triggered via a command that you sent or by changes that happened through other sources, such as the user directly interacting with the timer or an auto splitter.

The protocol is still work in progress and we will evolve it into a protocol that fully allows synchronizing timers over the network. #260

The event sink has now been renamed to command sink, because there is now a clear distinction between incoming commands and events that are the results of these commands.

@CryZe CryZe added enhancement An improvement for livesplit-core. c api The issue or pull request is about the C API. feature A new user visible feature for livesplit-core. networking Communication with an API is required. priority: high This is a high priority issue. labels Jun 22, 2024
@CryZe CryZe added this to the v0.14 milestone Jun 22, 2024
@CryZe CryZe requested a review from wooferzfg June 22, 2024 10:00
@CryZe
Copy link
Collaborator Author

CryZe commented Jun 22, 2024

Oh and because we now have specific error conditions for all the commands (split, undo_split, ...), there's a test for every possible error condition on every command. I think that should really help with robustness.

https://github.com/LiveSplit/livesplit-core/pull/819/files#diff-0b9fdd824c8bd101ce275c01f2a6a24a6b68b5cc857b99e14323a632b5e8e7d4

This implements a new improved version of the server protocol. The
following changes have been made:
- The protocol is based on JSON messages. This allows for example for
  more structured commands where it's easier to multiple arguments for a
  command and even have optional arguments.
- For each command, there is a corresponding response. It is either a
  `success` response with possibly the value that you requested, or an
  `error` response with an error `code`.
- On top of the responses you also get sent `event` messages that
  indicate changes to the timer. These can either be changes triggered
  via a command that you sent or by changes that happened through other
  sources, such as the user directly interacting with the timer or an
  auto splitter.

The protocol is still work in progress and we will evolve it into a
protocol that fully allows synchronizing timers over the network.

The event sink has now been renamed to command sink, because there is
now a clear distinction between incoming commands and events that are
the results of these commands.
@CryZe CryZe merged commit 922cc84 into LiveSplit:master Jun 22, 2024
70 checks passed
@CryZe CryZe deleted the server-protocol branch June 22, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c api The issue or pull request is about the C API. enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. networking Communication with an API is required. priority: high This is a high priority issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant