rstudio / httpuv

HTTP and WebSocket server package for R
Other
229 stars 86 forks source link

WebSockets should buffer events until event handlers are registered #104

Open jcheng5 opened 6 years ago

jcheng5 commented 6 years ago

It would be great if this, for example, didn't lose any messages:

app <- list(
  onWSOpen = function(ws) {
    later::later(~ws$onMessage(function(msg) {
      # Do something with msg
    }), 1000)
  }
)

This is something the Node.js community has dealt with (first lacking it, then having it): https://nodejs.org/api/stream.html#stream_two_modes