0

I have a Node.js web app that records audio, converts it to a base64 url, then (with socket.io) sends it to the server. This works fine locally, however I find that when I try to use DigitalOcean, it does not work if the audio base64 being sent is too large. If the audio is a few seconds, it will successfully be emitted to the server.

This is my client side code:

Fr.voice.exportMP3(function(url){
    console.log("base64 URL : " + url);
    var base64AudioInfo = {
        userId: $(".active-user-id").val(),
        noteId: $(".note-interface:visible > .active-note-id").val(),
        base64URL: url
    };
    socket.emit("set base64 audio", base64AudioInfo);
    $("<a href='"+ url +"' target='_blank'></a>")[0].click();
}, "base64");

And this is my server side code:

socket.on("set base64 audio", function(base64AudioInfo){
    console.log("Base 64 audio set!");
    // set base 64 audio
});

There is also some code that is in place of // set base 64 audio but it is very long and will probably overcomplicate things.

Locally, this works fine for audio base64 URLs of any size. However, when I put it on DigitalOcean, it only works for audio files that are a few seconds long. Is this likely an error with socket.io or an error contributed by DigitalOcean (perhaps by bandwidth limitations, etc.). I am using the 1GB Memory / 30 GB Disk / Ubuntu 17.04 x64 configuration if it helps.

Russell C.
  • 588
  • 6
  • 25

1 Answers1

0

Turns out, it was a problem with my nginx configuration. I referred to this post here: Meteor WebSocket handshake error 400 with nginx

Russell C.
  • 588
  • 6
  • 25