Giter VIP home page Giter VIP logo

httpuv's Introduction

Httpuv shim for webR

A minimal shim package for the httpuv package for webR.

This webR package is based on the original httpuv package for R, heavily modified to remove the original HTTP and WS server infrastructure. Instead, relevant callbacks to service HTTP and WS requests are made available for use in webR, so that they can be invoked using a JavaScript service worker.

Request functions

When a httpuv server is created, the following service functions are set in the global R options,

Name Arguments Description
webr_httpuv_onRequest (req) To be called with a HTTP request.
webr_httpuv_onWSOpen (handle, req) To be called when a WebSocket is opened.
webr_httpuv_onWSMessage (handle, binary, message) To be called when a WebSocket message is transmitted.

Request objects req follow the structure used in the original httpuv package, with the exception that HTTP requests should also include an additional element named uuid containing a universally unique identifier string. The HTTP response will contain the same UUID as an aid to matching requests with responses.

At the moment, WS requests should always be sent with a handle argument of 1.

Response format

HTTP and WS responses are transmitted over the established webR communication channel.

Message Type Description
_webR_httpuv_TcpResponse Response to a HTTP request with result contained in the data property.
_webR_httpuv_WSResponse A WS message transmitted from R with message content contained in the data property.

Limitations

Currently only one httpuv server can be created at a time. The server will always have a handle value of 1.

httpuv's People

Contributors

georgestagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.