ambiorix-web / ambiorix

🖥️ Web framework for R
http://ambiorix.dev
GNU General Public License v3.0
211 stars 9 forks source link

error when trying to use custom websocket handler function #62

Closed merlinoa closed 7 months ago

merlinoa commented 9 months ago

When trying to specify my own websocket handler function:

app$websocket <- \(ws){
  ws$onMessage(\(binary, message){
    cat("Received a message:", message, "\n")
  })
}

I get the following error:

Error in app$websocket <- function(ws) { : 
  cannot add bindings to a locked environment

I am following the documentation here:

https://ambiorix.dev/docs/ambiorix/websocket#bypass-ambiorix

I think this "websocket" field needs to be defined in the app or router, but I am not sure as I am not very familiar with websockets. Sorry if I am missing something obvious here.