Modern web programming involves coordinating interactions between browser clients and a server. Typically, the interactions in web-based distributed systems are informally described, making it hard to ensure correctness, especially communication safety, i.e. all endpoints progress without type errors or deadlocks, conforming to a specified protocol. We present STScript, a toolchain that generates TypeScript APIs for communication-safe web development over WebSockets, and RouST, a new session type theory that supports multiparty communications with routing mechanisms. STScript provides developers with TypeScript APIs generated from a communication protocol specification based on RouST. The generated APIs build upon TypeScript concurrency practices, complement the event-driven style of programming in full-stack web development, and are compatible with the Node.js runtime for server-side endpoints and the React.js framework for browser-side endpoints. RouST can express multiparty interactions routed via an intermediate participant. It supports peer-to-peer communication between browser-side endpoints by routing communication via the server in a way that avoids excessive serialisation. RouST guarantees communication safety for endpoint web applications written using STScript APIs. We evaluate the expressiveness of STScript for modern web programming using several production-ready case studies deployed as web applications.
翻译:通常,基于网络的分布式系统的互动以非正式的方式描述,使得很难确保正确性,特别是通信安全,即所有端点在不出现类型错误或僵局的情况下都进步,符合指定的协议。我们介绍了STScript,这是一个生成TypeScript API 用于在WebSockets上进行通信安全网络开发的工具链,以及RouST,这是一个支持多层次与路由机制沟通的新会话类型理论。STScript向开发者提供了基于 RouST 的通信协议规格生成的TypeScript APIs。生成的APIs以TypeScript condality 做法为基础,补充了全斯塔克网络开发中由事件驱动的编程风格,并与Node.js运行服务器端端端端点的网络安全开发时间和Ract.js 浏览端端端点的React.js框架兼容。RouST可以通过中间参与者表达多党际互动方式。它支持浏览端端端端端端端端端端端的通信端端端通信端通信端通信用户之间的通信通信通信通信,通过服务器安全端端端应用程序进行我们端端端研究,通过网络安全端端端端端端的网络安全端的网络安全性评估。