Description Usage Arguments Value Examples
This has to be used with websocket_client.
1 2 3 | websocket_server(host = "127.0.0.1", port = 8080)
websocket_client(host = "127.0.0.1", port = 8080)
|
host |
A string that is a valid IPv4 address that is owned by this server, or "0.0.0.0" to listen on all IP addresses. |
port |
A number or integer that indicates the server port that should be listened on. Note that on most Unix-like systems including Linux and Mac OS X, port numbers smaller than 1025 require root privileges. |
A client websocket connection
1 2 3 4 5 6 7 8 9 10 11 12 | if (interactive()) {
library(OSUICode)
server <- websocket_server()
client_1 <- websocket_client()
client_2 <- websocket_client()
client_1$send("Hello from client 1")
client_2$send("Hello from client 2")
client_1$close()
client_2$send("Only client 2 is here")
Sys.sleep(1)
server$stop()
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.