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

Create standard message types for communicating between web-worker and webui #3

Open
whiterook6 opened this issue Mar 17, 2021 · 1 comment

Comments

@whiterook6
Copy link
Owner

whiterook6 commented Mar 17, 2021

Deleted

@whiterook6
Copy link
Owner Author

whiterook6 commented May 25, 2021

Webworker:
From webui to worker:

{
  event: "begin-mining",
  previousHash: string, // 0123456789abcdef
  difficultyTarget: string, // "0000c"
}

From worker to webui

{
  event: "nonce-found",
  previousHash: string, // "0123456789abcdef"
  nonce: string, // "1c07d"
  hashes: number, // total hashes between starting nonce and resulting nonce
  seconds: number // since started mining, float
}
{
  event: "hash-rate",
  hashRate: number // hashes per second, like 200000
}

Websocket:
From client to server:

{
  event: "setID",
  player: string, // TIM
  team?: string // TUT
}

From server to clients:

{
  event: "block-found",
  block: Block,
  difficultyTarget: string
}
{
  event: "team-chat",
  message: Message // dunno format yet
}
{
  event: "global-chat",
  message: Message
}
{
  event: "team-score",
  scores: Score[]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant