Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rwynn/golang-sse-todo
golang server sent events (sse) example
https://github.com/rwynn/golang-sse-todo
golang knockoutjs mongodb server-sent-events sse
Last synced: 8 days ago
JSON representation
golang server sent events (sse) example
- Host: GitHub
- URL: https://github.com/rwynn/golang-sse-todo
- Owner: rwynn
- Created: 2013-04-27T14:56:20.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-28T02:23:22.000Z (over 9 years ago)
- Last Synced: 2023-03-10T20:08:30.608Z (over 1 year ago)
- Topics: golang, knockoutjs, mongodb, server-sent-events, sse
- Language: HTML
- Homepage:
- Size: 445 KB
- Stars: 23
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
golang server sent events (sse) todo example
===============This example was inspired by [golang-html5-sse-example](https://github.com/kljensen/golang-html5-sse-example) and [TodoMVC](http://todomvc.com/). It uses [knockout.js](http://knockoutjs.com) for the UI and [mongodb](http://www.mongodb.org/) for storage. It's a little different than the other TodoMVC examples in that it adds SSE capabilities to synchronize the todo list.
### Up and Running ###
#### Install Dependencies ####
Install [golang](http://golang.org/doc/install)
Install git and bazaar
sudo apt-get install git bzr
Install [mongodb](http://www.mongodb.org/downloads)
Install [mgo](https://labix.org/mgo), the mongodb driver for golang
mkdir -p ~/Go/vendor
export GOPATH=~/Go/vendor
go get gopkg.in/mgo.v2Clone this repository to your local filesystem
git clone https://github.com/rwynn/golang-sse-todo.git
#### Start the Servers ####
Start the mongo server if it's not already runningsudo mongod -f /etc/mongodb.conf
Run the Go server (assumes that $GOPATH already includes ~/Go/vendor to find mgo)
cd /path/to/golang-sse-todo
export GOPATH=$GOPATH:`pwd`
go run todo.go#### Create some Todos ####
Open 2 instances of your browser side by side (your browser should support html5 EventSource). Navigate
each browser to http://localhost:9080/static/Start typing todo items in one of the browser instances. The todo should be listed and dynamically updated
in both browser instances. Pressing return/enter will allow you to start entering a new todo.Stop the Go server by pressing Control-c in the terminal.