test_that("Websocket", {
expect_error(WebsocketHandler$new())
ws <- WebsocketHandler$new("hello", \(msg) {
return(msg)
})
msg <- ws$receive(list(message = "world"))
expect_equal(msg, "world")
expect_snapshot(ws)
ws <- Websocket$new(list())
expect_snapshot(ws)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.