inst/doc/overview.R

## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ---- eval = FALSE------------------------------------------------------------
#  ws <- WebSocket$new("ws://echo.websocket.org/")

## ---- eval = FALSE------------------------------------------------------------
#  ws <- WebSocket$new("ws://echo.websocket.org/", autoConnect = FALSE)
#  # Set up callbacks here...
#  ws$connect()

## ---- eval = FALSE------------------------------------------------------------
#  {
#    ws <- WebSocket$new("ws://echo.websocket.org/")
#    ws$onOpen(function(event) { message("websocket opened") })
#  }

## ---- eval = FALSE------------------------------------------------------------
#  {
#    ws <- WebSocket$new("ws://echo.websocket.org/")
#    ws$onOpen(function(event) {
#      cat("connected\n")
#    })
#  }

## ---- eval = FALSE------------------------------------------------------------
#  {
#    ws <- WebSocket$new("ws://echo.websocket.org/")
#    removeThis <- ws$onMessage(function(event) {
#      cat("this is the last time i'll run\n")
#      removeThis()
#    })
#    ws$onOpen(function(event) {
#      ws$send("one")
#      ws$send("two")
#    })
#  }

Try the websocket package in your browser

Any scripts or data that you put into this service are public.

websocket documentation built on Aug. 19, 2021, 1:08 a.m.