Giter VIP home page Giter VIP logo

golive's Introduction

Hi! ๐Ÿ‘‹

My current focus is creating tools that make a difference for people. From creating software useful to clients to creating software for developers.

Be kind, be useful, and be happy. That is all that matters.

My personal website: brendonmatos.com

brendonmatos stats

Snake animation

trophy

golive's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

golive's Issues

Click event not firing server side

Hello! I'm new to GoLive but I'm really excited about this project! I've ran the examples and I've tried to create my own from the start to get familiar but I'm struggling to get a simple button click event to fire on the server side.

I have the following HTML:

<button go-live-click="HandleUp">+</button>

And on the server I have this but the Println() doesn't seem to fire.

func (t *Thermostat) HandleUp() {
	fmt.Println("UP")
	t.Temperature = 50
}

I would really appreciate any help!

Views are not syncing across browser windows in examples

Steps taken:

  1. cd examples/slider
  2. go build
  3. ./slider
  4. Open http://127.0.0.1:3000 in two windows
  5. Play with the slider

Expected:
The same thing happens in both windows at the same time.

Actual:
Only the window where the user is interacting gets updated.

I also saw this with the todo example. It happened both on Chrome and Safari on Mac.

page reloads unmounts old components but they are destroyed in the server and still try push data

step to reproduce:

  • run server with 1 or more components (like clock one which updates via server events)
  • reload the page
  • see the warning WRN handle ws request: unexpected connection close
  • start seeing errors every timestep the clock old clock component was updating

Error logs below

 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” 
 โ”‚                    Fiber v2.2.3                   โ”‚ 
 โ”‚               http://127.0.0.1:9000               โ”‚ 
 โ”‚                                                   โ”‚ 
 โ”‚ Handlers ............. 4  Processes ........... 1 โ”‚ 
 โ”‚ Prefork ....... Disabled  PID ........... 2042802 โ”‚ 
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 

GL 16:10:42 WRN handle ws request: unexpected connection close
GL 16:10:42 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:42 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:43 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:43 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:44 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:44 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:45 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:45 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:46 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:46 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:47 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:47 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:48 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:48 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:49 WRN handle ws request: unexpected connection close
GL 16:10:49 ERR call to commit on unmounted Component name=Root_gf946
GL 16:10:49 ERR call to commit on unmounted Component name=Root_i4d5f
GL 16:10:49 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:49 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:50 ERR call to commit on unmounted Component name=Root_i4d5f
GL 16:10:50 ERR call to commit on unmounted Component name=Root_gf946
GL 16:10:50 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:50 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:51 ERR call to commit on unmounted Component name=Root_i4d5f
GL 16:10:51 ERR call to commit on unmounted Component name=Root_gf946
GL 16:10:51 ERR call to commit on unmounted Component name=Root_ksoMy
GL 16:10:51 ERR call to commit on unmounted Component name=Root_bHk6G
GL 16:10:52 ERR call to commit on unmounted Component name=Root_gf946
GL 16:10:52 ERR call to commit on unmounted Component name=Root_i4d5f

panic upon closing todo window

Steps taken:

  1. cd examples/todo
  2. go build
  3. ./todo
  4. Open http://127.0.0.1:3000 in a browser window
  5. Close the window.

Expected:
The server keeps running.

Actual:
The server crashes like this:

GL 21:20:52 WRN handle ws request: unexpected connection close
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13eabf1]

goroutine 52 [running]:
github.com/fasthttp/websocket.(*Conn).Close(...)
        /Users/issactrotts/pkg/mod/github.com/fasthttp/[email protected]/conn.go:344
github.com/brendonmatos/golive.(*LiveServer).HandleWSRequest.func2()
        /Users/issactrotts/src/github.com/brendonmatos/golive/server.go:196 +0x471
created by github.com/brendonmatos/golive.(*LiveServer).HandleWSRequest
        /Users/issactrotts/src/github.com/brendonmatos/golive/server.go:182 +0x305

websocket queue

This project is retty interesting.

You might want to look into adding NATS to this system:
Web sockets for NATS and soon Nats Jetstream is happening. See:
https://github.com/nats-io/nats.ws

It would make it easier to have 100's of distributed golang servers in sync with browser clients.

Not sure if you know NATS ?

The CLI now has Jetstream included ..

Let me know what you think...

How to use with a template engine

Thanks so much for this project! I'm finding it really fun to work with.

I'm new to gofiber and I was wondering how would I use golive with gofiber and a template engine instead of returning static HTML like in your examples in the TemplateHandler function. I tried using a template engine but it looks like none of the data or interaction is correctly working in an interactive way.

Something like

	app.Get("/", func(c *fiber.Ctx) error {
		// Render index template
		return c.Render("view", fiber.Map{
			"Title": "Hello, World!",
		})
	})

I do see one mistake I have here which is there's no creation of the model object, but I'm not really sure how this flows with golive so I'm a little confused. I would really appreciate the help! Thanks so much for putting your time into this project I tried a bunch of similar ones and this one has been by far the funnest one to work with.

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.