Skip to content

Server notification through WebSocket to browser #92

Description

@jeff1evesque

Each audio segment (from the browser) sent to the server should trigger a notification mechanism, a receipt, notifiying users the length of the audio clip saved onto the server, and how many segments have been saved on the server. This helps ensure the WebSocket stream transferred audio to the server properly. We may also compute the total length of the audio clip, and send this data to the browser as well.

This may provide a coding outline for the task sending converted audio from the server, back to the browser.

The following code from initializer.js will need to be adjusted:

...
  // Getting messages from server through WebSocket, either a result or an error
  websocket.onmessage = function(e) {
    result = JSON.parse(e.data);
    if (typeof(result.score) !== 'undefined')
      document.getElementById("result").innerHTML = "Score: " + result.score + " Speed: " + result.speed + " Words: " + result.words;
    if (typeof(result.error) !== 'undefined')
      document.getElementById("error").innerHTML = result.error;
    else
      document.getElementById("error").innerHTML = "";
    }
}
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions