All Projects → brendonmatos → Golive

brendonmatos / Golive

Licence: mit
⚡ Live views for GoLang with reactive HTML over WebSockets 🔌

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Golive

Live
Live views and components for golang
Stars: ✭ 251 (+93.08%)
Mutual labels:  websockets, virtual-dom, server-side-rendering
core
Server side rendering with The Elm Architecture in Deno
Stars: ✭ 16 (-87.69%)
Mutual labels:  virtual-dom, server-side-rendering
Cable ready
CableReady completes the ActionCable story and expands the utility of web sockets in your Rails app
Stars: ✭ 489 (+276.15%)
Mutual labels:  virtual-dom, server-side-rendering
Korolev
Single Page Applications running on the server side.
Stars: ✭ 510 (+292.31%)
Mutual labels:  virtual-dom, server-side-rendering
Vidom
Library to build UI based on virtual DOM
Stars: ✭ 408 (+213.85%)
Mutual labels:  virtual-dom, server-side-rendering
Nanomorph
🚅 - Hyper fast diffing algorithm for real DOM nodes
Stars: ✭ 621 (+377.69%)
Mutual labels:  diff, virtual-dom
Daff
Diff, patch and merge for data.frames, see http://paulfitz.github.io/daff/
Stars: ✭ 121 (-6.92%)
Mutual labels:  diff
Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+1713.85%)
Mutual labels:  diff
Cljs Vdom
Yet another (but somewhat novel) virtual DOM library
Stars: ✭ 122 (-6.15%)
Mutual labels:  virtual-dom
Wshook
Easily intercept and modify WebSocket requests and message events.
Stars: ✭ 121 (-6.92%)
Mutual labels:  websockets
Fs2 Http
Http Server and client using fs2
Stars: ✭ 132 (+1.54%)
Mutual labels:  websockets
Surmon.me
🆒 My personal website and blog, powered by @vuejs (3)
Stars: ✭ 1,767 (+1259.23%)
Mutual labels:  server-side-rendering
Learnvue
Vue.js 源码解析
Stars: ✭ 11,516 (+8758.46%)
Mutual labels:  diff
Sente
Realtime web comms for Clojure/Script
Stars: ✭ 1,626 (+1150.77%)
Mutual labels:  websockets
Huobi
火币的行情交易的python实现
Stars: ✭ 129 (-0.77%)
Mutual labels:  websockets
Tap Tap Adventure
Tap Tap Adventure is a massively online 2D MMORPG set in the medieval times with twists.
Stars: ✭ 123 (-5.38%)
Mutual labels:  websockets
Universal Native Boilerplate
Build apps for every native platform with React and React Native
Stars: ✭ 131 (+0.77%)
Mutual labels:  server-side-rendering
React Native Mqtt
Mqtt client for react native.
Stars: ✭ 122 (-6.15%)
Mutual labels:  websockets
Sish
HTTP(S)/WS(S)/TCP Tunnels to localhost using only SSH.
Stars: ✭ 2,087 (+1505.38%)
Mutual labels:  websockets
Diff2html
Pretty diff to html javascript library (diff2html)
Stars: ✭ 1,867 (+1336.15%)
Mutual labels:  diff

GoLive

💻 Reactive HTML Server Side Rendered by GoLang over WebSockets 🚀

Use Go and Zero JavaScript to program reactive front-ends!

How?

  1. Render Server Side HTML
  2. Connect to same server using Websocket
  3. Send user events
  4. Change state of component in server
  5. Render Component and get diff
  6. Update instructions are sent to the browser

Getting Started

Any suggestions are absolutely welcome

This project it's strongly inspired by Elixir Phoenix LiveView.

Component Example

package components 

import (
	"github.com/brendonmatos/golive"
	"time"
)

type Clock struct {
	golive.LiveComponentWrapper
	ActualTime string
}

func NewClock() *golive.LiveComponent {
	return golive.NewLiveComponent("Clock", &Clock{})
}

func (t *Clock) Mounted(_ *golive.LiveComponent) {
	go func() {
		for {
			t.ActualTime = time.Now().Format(time.RFC3339Nano)
			time.Sleep((time.Second * 1) / 60)
			t.Commit()
		}
	}()
}

func (t *Clock) TemplateHandler(_ *golive.LiveComponent) string {
	return `
		<div>
			<span>Time: {{ .ActualTime }}</span>
		</div>
	`
}

Server Example

  
package main

import (
	"github.com/brendonmatos/golive"
	"github.com/brendonmatos/golive/examples/components"
	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/websocket/v2"
)

func main() {
	app := fiber.New()
	liveServer := golive.NewServer()

	app.Get("/", liveServer.CreateHTMLHandler(components.NewClock, golive.PageContent{
		Lang:  "us",
		Title: "Hello world",
	}))

	app.Get("/ws", websocket.New(liveServer.HandleWSRequest))

	_ = app.Listen(":3000")
}

That's it!

More Examples

Slider

Simple todo

All at once using components!

GoBook

Go to repo

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].