All Projects → ShikaSD → Compose Server Side

ShikaSD / Compose Server Side

Experiment with server side rendering using compose and ktor

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Compose Server Side

Poseidon
Poseidon Server Framework (refactor WIP)
Stars: ✭ 162 (+23.66%)
Mutual labels:  coroutines, server, websocket
Laravel S
LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.
Stars: ✭ 3,479 (+2555.73%)
Mutual labels:  server, websocket
Mmorpg
springboot编写的轻量级高性能mmorpg手游服务端框架,基本功能逐渐完善中。
Stars: ✭ 309 (+135.88%)
Mutual labels:  server, websocket
Glass Isc Dhcp
Glass - ISC DHCP Server Interface
Stars: ✭ 486 (+270.99%)
Mutual labels:  server, websocket
Acl
Server framework and network components written by C/C++ for Linux, Mac, FreeBSD, Solaris(x86), Windows, Android, IOS
Stars: ✭ 2,113 (+1512.98%)
Mutual labels:  coroutines, websocket
Rsocket Kotlin
RSocket Kotlin multi-platform implementation
Stars: ✭ 256 (+95.42%)
Mutual labels:  coroutines, websocket
Swoole Src
🚀 Coroutine-based concurrency library for PHP
Stars: ✭ 17,175 (+13010.69%)
Mutual labels:  coroutines, websocket
Actionhero
Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks
Stars: ✭ 2,280 (+1640.46%)
Mutual labels:  server, websocket
Agoo
A High Performance HTTP Server for Ruby
Stars: ✭ 679 (+418.32%)
Mutual labels:  server, websocket
Simple Websocket Server
A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++.
Stars: ✭ 685 (+422.9%)
Mutual labels:  server, websocket
Clusterws
💥 Lightweight, fast and powerful framework for building scalable WebSocket applications in Node.js
Stars: ✭ 868 (+562.6%)
Mutual labels:  server, websocket
Socketcluster Server
Minimal server module for SocketCluster
Stars: ✭ 70 (-46.56%)
Mutual labels:  server, websocket
Butterfly Server
The Everything is Real-Time C# Backend for Single Page Applications
Stars: ✭ 247 (+88.55%)
Mutual labels:  server, websocket
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+2374.05%)
Mutual labels:  server, websocket
Qtswissarmyknife
QSAK (Qt Swiss Army Knife) is a multi-functional, cross-platform debugging tool based on Qt.
Stars: ✭ 196 (+49.62%)
Mutual labels:  server, websocket
Simps
🚀 A simple, lightweight and high-performance PHP coroutine framework.
Stars: ✭ 318 (+142.75%)
Mutual labels:  server, websocket
Jstp
Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF
Stars: ✭ 132 (+0.76%)
Mutual labels:  server, websocket
Crossbar
Crossbar.io - WAMP application router
Stars: ✭ 1,957 (+1393.89%)
Mutual labels:  server, websocket
Impress
Enterprise application server for Node.js and Metarhia private cloud ⚡
Stars: ✭ 634 (+383.97%)
Mutual labels:  server, websocket
Gophergameserver
🏆 Feature packed, easy-to-use game server API for Go back-ends and Javascript clients. Tutorials and examples included!
Stars: ✭ 61 (-53.44%)
Mutual labels:  server, websocket

Compose on the server side

Now live on Heroku!

This is a prototype of porting compose as a feature of a Ktor server rather than running it on Android.

The original idea belongs to SwiftWebUI project, rendering HTML page using websocket commands from server.

Works with dev-15 with minor changes.

Show me the code!

fun Application.module() {
    install(Compose)

    routing {
        compose {
            var state by remember { mutableStateOf(1) }
            h1 { 
                text("Counter value is $state") 
            }
            button(Modifier.onClick { state++ }) { 
                text("Increment!")
            }
        }
    }
}

How does it work?

TLDR; Compose + Websocket goes brrrr

Scheme

  • Compose starts with some initial state which results in the server-side representation of a webpage.
  • This representation is sent to the client as commands of adding/removing/moving nodes through websocket. The client then changes the structure of the webpage according to commands received from the server.
  • When a client event happens (for example click), it is sent to the server. Here, the state is updated with the new changes. It yields a different structure of the DOM, and these updates are sent to the client, refreshing the webpage.

Full story on Medium.

Building it

You can use deploy branch with prebuilt artifacts of runtime.

integration module contains implementation of an on both JS and server side. Ideally, this is the part you could write if this library will be ever published.

The Ktor feature with all the definitions is in the server module and browser runtime is in the client one.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].